Search code examples
phpwamppharhttpful

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.


Solution

  • 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');