Jump to content

cURL WebService can't load


DevMvrht

Recommended Posts

Hello,
 
 
I am currently trying to set up the WebService on my shop currently "hosted" on my localhost.
 
I am following the Web service tutorial on the Prestashop documentation and I have issues with the Chapter 3 - First steps - Accessing the web service and listing customers.
 
As indicated in the documentation I have :

  • Enabled cURL from the good PHP.ini (used by PHP)
  • Downloaded the WebServiceLibrary script at the root of my shop
  • Created my own script at the root of the shop and called the WebService as follow :
try
{
    $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
    
    //$xml = $webService->get(array('resource' => 'carts'));
    $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/carts?schema=blank'));
    
}
catch (PrestaShopWebserviceException $e)
{
    // Here we are dealing with errors
    $trace = $e->getTrace();
    if ($trace[0]['args'][0] == 404) echo 'Bad ID';
    else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
    else
    echo 'Other error<br />'.$e->getMessage();
}

However, when accessing the script from my browser, I get the following error :

 

Fatal error: Maximum execution time of 30 seconds exceeded in ...\PSWebServiceLibrary.php on line 140

 
The line 140 of the scripts refers to call to the curl_exec function : 
 
 

$session = curl_init($url);
//...     
curl_setopt_array($session, $curl_options);
$response = curl_exec($session);

 
When accessing the desired url from the browser itself, I get the response right away.
 
I tried to change the options given to cURL according to what I found on the internet

Here is information about my setup taken from the Prestashop admin panel and phpinfo() function :
 
 

STORE INFORMATION
PrestaShop version: 1.6.1.11 // I have also tested with Prestashop 1.7
Shop URL: http://localhost/projects/prestashop_1.6/
Current theme in use: default-bootstrap
 
 

 SERVER INFORMATION
OS : Windows 10
Wamp Package : EasyPHP
Server software version: Apache/2.4.7 (Win32) PHP/5.4.24
PHP version: 5.4.24
Memory limit: 1024M
Max execution time: 30

 CURL
 

cURL support : enabled

cURL Information : 7.30.0

 

The shop is totally clear, I just have installed prestashop and activated the webservice right after.
 
Thanks in advance for your help

Edited by DevMvrht (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...