Salut,

Dans le code ci-dessous, j'essaie de faire un appel a l'API de Magento mais ca ne marche pas. J'ai une erreur HTTP 503. Vous pouvez m'aider? Voila mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
 
    ini_set("display_errors", 1);
    error_reporting(E_ALL);
    define("XMLRPC_DEBUG", 1);
 
    require_once $_SERVER['DOCUMENT_ROOT'] . "/app/Mage.php";
 
    $client        = new Zend_XmlRpc_Client('http://domain.fr/api/xmlrpc/');
    $session        = $client->call('login', array('admin', 'key'));
    $result        = $client->call('call', array($session, 'category.tree'));
 
    function get_cat($cat)
    {
        $sep = ';';
        $cols = str_repeat($sep,$cat['level']+1);
        printf("\"%s\"%s\"%s\"\n",$cat['category_id'],$cols,$cat['name']);
        foreach ($cat['children'] as $child)
        {
            get_cat($child);
        }
    }
 
    echo '<pre>';
    get_cat($result);
    echo '<pre>';
 
    $client->call('endSession', array($session));
 
?>
Voila le detail:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
Fatal error: Uncaught exception 'Zend_XmlRpc_Client_HttpException' with message 'Service Temporarily Unavailable' in /var/www/vhosts/domain.fr/httpdocs/lib/Zend/XmlRpc/Client.php:284 Stack trace: #0 /var/www/vhosts/domain.fr/httpdocs/lib/Zend/XmlRpc/Client.php(339): Zend_XmlRpc_Client->doRequest(Object(Zend_XmlRpc_Request)) #1 /var/www/vhosts/domain.fr/httpdocs/magic_rpc.php(10): Zend_XmlRpc_Client->call('login', Array) #2 {main} thrown in /var/www/vhosts/domain.fr/httpdocs/lib/Zend/XmlRpc/Client.php on line 284
J'ai remplace le login/cle de l'api et le nom de domaine dans le code pour plus de securite.

Merci

Stephane