Jump to content

HTTP/Request Issue


goplutus

Recommended Posts

I'm trying to integrate w/ a few APIs, and getting started is causing me fits. I'm using PHP locally to add common headers and as a contact form, and those are working fine.

The Code:

<?php

 

require('HTTP/Request.php');

 

$url = "http://example.com";

 

$request =& new HTTP_Request($url);

$request->sendRequest();

$response = $request->getResponseBody();

 

?>

 

The Result:

 

Warning: require(HTTP/Request.php) [function.require]: failed to open stream: No such file or directory in /home/stodgy5/public_html/trackstart/start.php on line 3

 

Warning: require(HTTP/Request.php) [function.require]: failed to open stream: No such file or directory in /home/stodgy5/public_html/trackstart/start.php on line 3

 

Fatal error: require() [function.require]: Failed opening required 'HTTP/Request.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/stodgy5/php') in /home/stodgy5/public_html/trackstart/start.php on line 3

 

 

I'm assuming this is a directory issue, as my cPanel says Pear is installed. Any advice?

Link to comment
https://forums.phpfreaks.com/topic/220892-httprequest-issue/
Share on other sites

Where is "Request.php" stored on the server?  Here's what happens with your require() line...

 

PHP will search in any of the include_paths for "request.php" as well as the current working directory.  So it will search:

 

1) /usr/lib/php/Request.php

2) /usr/local/lib/php/Request.php

3) /home/stodgy5/php/Request.php

4) /home/stodgy5/public_html/trackstart/Request.php

 

If it doesn't find the file in any of those locations it will fail.

Link to comment
https://forums.phpfreaks.com/topic/220892-httprequest-issue/#findComment-1143827
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.