1
如何在PHP中使用get方法或POST方法來解析這個 網址http://mohamedkaremullasha.vendhq.com/api/products 用戶ID:[email protected] 密碼:xxxxxxx123結果將是:JSON格式如何與認證約VendHQ PHP解析JSON結果的API
樣品從URL導致了上面提到
{
"products": [
{
"id": "e8a29afd-9aba-11e3-a0f5-b8ca3a64f8f4",
"source_id": "",
"variant_source_id": "",
"handle": "tshirt",
"type": "",
"variant_parent_id": "",
"variant_option_one_name": "",
"variant_option_one_value": "",
"variant_option_two_name": "",
"variant_option_two_value": "",
"variant_option_three_name": "",
"variant_option_three_value": "",
"active": true,
"name": "T-shirt (Demo)",
"description": "T-shirt, white. You can delete this once you have some other products setup",
"image": "http:\/\/mohamedkaremullasha.vendhq.com\/images\/placeholder\/product\/no-image-white-thumb.png",
"image_large": "http:\/\/mohamedkaremullasha.vendhq.com\/images\/placeholder\/product\/no-image-white-original.png",
"sku": "tshirt-white",
"tags": "General",
"brand_id": "e8a892db-9aba-11e3-a0f5-b8ca3a64f8f4",
"brand_name": "Generic Brand",
"supplier_name": "mohamed karemullasha",
"supplier_code": "",
"supply_price": "2.00",
"account_code_purchase": "",
"account_code_sales": "",
"inventory": [
],
"price_book_entries": [
{
"id": "e8a94a50-9aba-11e3-a0f5-b8ca3a64f8f4",
"product_id": "e8a29afd-9aba-11e3-a0f5-b8ca3a64f8f4",
"price_book_id": "e89a21c7-9aba-11e3-a0f5-b8ca3a64f8f4",
"price_book_name": "General Price Book (All Products)",
"type": "BASE",
"outlet_name": "",
"outlet_id": "",
"customer_group_name": "All Customers",
"customer_group_id": "e897507a-9aba-11e3-a0f5-b8ca3a64f8f4",
"price": 4.95,
"loyalty_value": null,
"tax": 0,
"tax_id": "e89da751-9aba-11e3-a0f5-b8ca3a64f8f4",
"tax_rate": 0,
"tax_name": "No Tax",
"display_retail_price_tax_inclusive": 0,
"min_units": "",
"max_units": "",
"valid_from": "",
"valid_to": ""
}
],
"price": 4.95,
"tax": 0,
"tax_id": "e89da751-9aba-11e3-a0f5-b8ca3a64f8f4",
"tax_rate": 0,
"tax_name": "No Tax",
"display_retail_price_tax_inclusive": 0,
"updated_at": "2014-02-21 05:42:10",
"deleted_at": ""
}
]
}
謝謝朋友。它的工作很酷。 – KMS
你可以暗示我在同一個問題上獲取標記基礎值檢索 – KMS
你的意思是解析json?你可以使用json_decode http://www.php.net/manual/en/function.json-decode.php – SajithNair