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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.