からの結果を解読しようとすると、ここに私のコード(CURL)
です:私は空白の画面が表示され、このコードでJSON /カールがGETリクエスト
<?php
$url = "http://www.sportsdirect.com/DesktopModules/ProductDetail/API/ItemSuggestions/GetProductSuggestions?productId=433006&numPlacements=1&ItemType=product";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIE, "ChosenSite=www; SportsDirect_AnonymousUserCurrency=GBP; language=en-GB");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($ch, CURLOPT_VERBOSE, true);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
// Will dump a beauty json :3
$collections = json_decode($result);
foreach ($collections as $item) {
$Title = $item->Products->Title;
echo $Title;
}
、何の結果が出力されません。 私が欲しいのは、echo
すべての製品のすべてTitle
の名前です。
私の間違いはどこにありますか、私は何をしたいのですか?