【发布时间】:2015-10-15 03:05:36
【问题描述】:
我在通过 WebServices 创建新地址时遇到问题 我使用 PrestaShop 1.6.0.14 和 PSWebServiceLibrary 这是我的代码:
try
{
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
$xml = $webService->get( array( 'url' => 'http://raj-dla-ogrodu.pl/api/addresses?schema=blank' ) );
$resources = $xml->children()->children();
$infos = array(
'id_customer' => '50',
'id_country' => '14',
'id_state' => '0',
'alias' => 'Allegro',
'id_manufacturer' => '0',
'id_supplier' => '0',
'id_warehouse' => '0',
'deleted' => '0',
'lastname' => 'test',
'firstname' => 'test',
'address1' => 'Klient',
'address2' => '111',
'postcode' => $transakcje->RecipientZip,
'city' => 'test',
'phone_mobile' => $transakcje->RecipientPhone,
'phone' => $transakcje->RecipientPhone,
);
foreach ($resources as $nodeKey => $node)
{
$resources->$nodeKey = $infos[$nodeKey];
}
$opt = array('resource' => 'customers');
$opt['postXml'] = $xml->asXML();
$xml = $webService->add($opt);
}
catch (PrestaShopWebserviceException $ex)
{
}
我收到了 Bad Response 错误。任何线索我做错了什么?
【问题讨论】:
-
在浏览器中尝试
url,如果它是正确的,只需很少的参数。
标签: php web-services prestashop prestashop-1.6