如何将XML数组传递给Shopify API调用

时间:2012-11-02 11:16:08

标签: php api shopify

<?xml version="1.0" encoding="UTF-8"?>
<product>
   <id type="integer">100159400</id>
<title>150 Watt Mini Stereo Power Amplifier</title>
<variants type="array">
<variant>
<id type="integer">233139732</id>
<grams type="integer">700</grams>
<inventory-quantity type="integer">222</inventory-quantity>
 </variant>
</variants>
</product>

它对我不起作用。我在shopify api调用中解析xml数组

$recurring_application_charge = $shopify('PUT', '/admin/products/109720638.xml', $product);

这里我正在解析单个值但我需要传递动态值,我在shopify商店中插入记录后存储在数据库中。甚至更新命令对我来说对单个产品也不起作用。请帮帮我,

1 个答案:

答案 0 :(得分:1)

如果您使用的是Sandeep的PHP适配器,则必须在(Shopify.php)中将内容类型更改为XML。默认情况下,适配器使用Json格式来发送POST请求。