且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 SOAP 连接到 Magento API

更新时间:2022-10-31 13:30:26

你把它放到一个新的空白文件中.将其另存为 name.php 并在您的服务器上运行:

You put this into a new blank file. Save this as name.php und run this is on your server:

<?php
        $host = "127.0.0.1/magento/index.php"; //our online shop url
        $client = new SoapClient("http://".$host."/api/soap/?wsdl"); //soap handle
        $apiuser= "user"; //webservice user login
        $apikey = "key"; //webservice user pass
        $action = "sales_order.list"; //an action to call later (loading Sales Order List)
        try { 

          $sess_id= $client->login($apiuser, $apikey); //we do login


        print_r($client->call($sess_id, $action));
        }
        catch (Exception $e) { //while an error has occured
            echo "==> Error: ".$e->getMessage(); //we print this
               exit();
        }
?>

问候博蒂