0
我試圖從Instagram中提取用戶個人資料圖片,但我無法成功地成功地將echo
所需的數組。如何從cURL JSON中正確提取數組?
$url="https://www.instagram.com/selenagomez/media/";
// Initiate curl
$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
$json=curl_exec($ch);
// Closing
curl_close($ch);
$result = json_decode($json, true);
echo $result[0]["profile-picture"];
我越來越:Notice: Undefined offset: 0 in test.php on line 23
還試圖排除第二JSON參數(true
),它並沒有幫助。
太謝謝你了! – Ricardo