简体   繁体   中英

php include httpful phar through wamp

I have trouble implementing the beginning actions to include the phar library of httpful framework.

I would greatly appreciate if someone could point out where i am confused, even wrong slashes. I am using WAMP server and have my php testing files in C:\\wamp\\www\\phptesting. In the same folder i have copied the httpful.phar file and the code i am trying to run is below.

Take into consideration that the uri i use is valid and when set into a browser it returns the expected response.

Thank you in advance for any thoughts

<?php

include('httpful.phar');
$uri='http://________List';

use Httpful\Request;
$response = Request::get($uri)->send();

echo 'Response:' . $response;

?>

UPDATE

I finally got the response needed. The only issue was that i did not use an echo to get the outcome, i thought it would print the response itself... When one is new, one gets confused easily. I thank everyone for their thoughts and tries, and the comment about the path below is correct.

I have reviewed the code to the working one for the community.

You should include the file from the web server's perspective, not the local file system's perspective. And in the question you have mentioned,

In the same folder i have copied the httpful.phar file

In that case use the following statement to include your httpful.phar file.

include('httpful.phar');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM