0

Note: Beginner to php and programming on web databases.

I am trying to implement the Tesco API on the 000webhost webhosting site. I've copied the PHP script at the Tesco labs page, put it in the database at 000webhost where I call it with the index.php script, however when I tried to implement the code, it gives me this error:

Warning: require_once(HTTP/Request2.php): failed to open stream: No such file or directory in /storage/ssd4/772/1967772/public_html/tesco_api.php on line 3

Fatal error: require_once(): Failed opening required 'HTTP/Request2.php' (include_path='.:/usr/share/pear:/usr/share/php') in /storage/ssd4/772/1967772/public_html/tesco_api.php on line 3

From the error message, the culprit is this line in the Tescolab API script:

require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://dev.tescolabs.com/product/');

Which seems to give an error because of some missing pear installation (don't really understand this)

It seems impossible to install this pear thing on 000webhost, and I've tried searching for workarounds for the HTTP_Request2, such as by using curl, but I can't seem to find a working solution. I also couldn't understand what the comment in the Tesco API meant:

// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)

If someone could propose a solution to this issue, either with a curl workaround, or by managing to install the pear thing

m_cheah
  • 131
  • 1
  • 1
  • 8
  • try using the full path to the class files rather than the relative one – Professor Abronsius Jun 16 '17 at 12:27
  • what do you mean by the full path? Not too familiar with using php and api's in general so if you could elaborate, that would be great. Thanks – m_cheah Jun 16 '17 at 12:29
  • typically PHP will look in particular directories when using `include` or `require` etc - as the `HTTP` directory referenced in the code is a relative path you might find that using the full path ( ie: from document root - `include( $_SERVER['DOCUMENT_ROOT'] . '/path/to/HTTP/Request2.php' );` – Professor Abronsius Jun 16 '17 at 14:18

0 Answers0