Jump to content

Webservice Bad Response


JoaquinSeller

Recommended Posts

Hello.

 

I have the following code:

require 'Class/PrestaShopWebservice.php';


try {
// creating web service access
    $webService = new PrestaShopWebservice(
            MY_URL, MY_KEY, false);
// call to retrieve all clients
    $xml =  $webService->get(array('url' => MY_URL.'/api/categories?schema=blank'));
    
} catch (PrestaShopWebserviceException $ex) {
    $trace = $ex->getTrace();
// Retrieve all information on the error
    $errorCode = $trace[0]['args'][0]; // Retrieve the error code
    if ($errorCode == 401)
        echo 'Bad auth key';
    else
        echo 'Other error : <br />' . $ex->getMessage();
}

The response id:

Array ( [status_code] => 401 [response] => [header] => HTTP/1.1 401 Unauthorized Date: Thu, 24 Apr 2014 21:02:55 GMT Server: Apache X-Powered-By: PHP/5.3.3 WWW-Authenticate: Basic realm="Welcome to PrestaShop Webservice, please enter the authentication key as the login. No password required." Set-Cookie: 5a2c67b4928ffe5745bb882ad7942d17=rNd338c%2Fnc4gUy1YOJzW8d8pOjHiuYuK84soXHn2pFNDopglOHzoZjThzmeen1l1a48sVoWPrvSPFx59%2F0%2BIvBQz5I0yPSvZ17OYmN0u3b0%3D000079; expires=Wed, 14-May-2014 21:02:55 GMT; path=/; domain=MY_DOMAIN; httponly Vary: Host,Accept-Encoding X-Powered-By: PleskLin Content-Length: 0 Content-Type: text/html; charset=utf-8 ) Bad auth key

What the problems?

 

Helps.

 

Thank you.

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