ok so i got order09-05-12-1346847709.xml file in my webserver’s order folder through webhook from shopify webhook test and the file looks like
…………………………………………….
<processing-method nil="true"></processing-method>
<line-items type="array">
<line-item>
<requires-shipping type="boolean">true</requires-shipping>
<fulfillment-service>manual</fulfillment-service>
<grams type="integer">5000</grams>
<price type="decimal">199.99</price>
<quantity type="integer">1</quantity>
<sku>SKU2006-001</sku>
<title>Sledgehammer</title>
<product-id type="integer" nil="true"></product-id>
<variant-id type="integer" nil="true"></variant-id>
<vendor nil="true"></vendor>
<variant-title nil="true"></variant-title>
<fulfillment-status nil="true"></fulfillment-status>
<name>Sledgehammer</name>
<variant-inventory-management nil="true"></variant-inventory-management>
<properties type="array">
</properties>
</line-item>
<line-item>
<requires-shipping type="boolean">true</requires-shipping>
<fulfillment-service>manual</fulfillment-service>
<grams type="integer">500</grams>
<price type="decimal">29.95</price>
<quantity type="integer">1</quantity>
<sku>SKU2006-020</sku>
<title>Wire Cutter</title>
<product-id type="integer" nil="true"></product-id>
<variant-id type="integer" nil="true"></variant-id>
<vendor nil="true"></vendor>
<variant-title nil="true"></variant-title>
<fulfillment-status nil="true"></fulfillment-status>
<name>Wire Cutter</name>
<variant-inventory-management nil="true"></variant-inventory-management>
<properties type="array">
</properties>
</line-item>
</line-items>
………………………………………………………………
and all i need is pick “sku and qty” value so i can update to my ms sql server’s data automatically how do i do that using php i mean i know how to connect to sql server using sqlsrv and but don’t know php code to pick specific field’s value and put values to sql server
plz guys i am desperate now ….
Thank you so much guys in advance
Here is some PHP code which fetches the
skuandquantityvalue for each item in your XML document (it’s not the best/nicest/most powerful way to search for particular piece of information in an XML document, but it works). Since you don’t tell us how you want to insert them in your database, I cannot do much more.Here is the documentation about the PHP Document Object Model interface, which allows manipulation of XML documents. Please have a look at it.