【发布时间】:2016-05-04 10:25:23
【问题描述】:
我提出这个 curl 请求:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "affiliate-feeds.snapdeal.com/feed/api/order?startDate=2016-01-01&endDate=2016-05-03&status=approved");
curl_setopt(
$ch, CURLOPT_HTTPHEADER,
array(
'Snapdeal-Affiliate-Id:'.$affiliateId,
'Snapdeal-Token-Id:'.$token,
'Accept:application/json'
)
);
$response = curl_exec($ch);
curl_close($ch);
// work with $response here:
$jsonData = json_decode($response);
Mage::log( $jsonData["productDetails"][0]["product"]);
回复是这样的:
{"productDetails":[{"product":"Philips QT4000 Trimmer Black","category":"Appliances","orderCode":"12569696012","quantity":1,"price":936.0,"sale":936.0,"commissionRate":1.0,"commissionEarned":9.36,"dateTime":"03/29/2016 22:49:06","affiliateSubId1":"","affiliateSubId2":"null","userType":"EXISTING","deviceType":"web"}],"nextURL":null}
日志语句不打印任何内容。我在这里做错了什么?
【问题讨论】:
-
VISIT this,使用
json_decode($response,true)会返回一个关联数组...