1 回答
TA贡献1799条经验 获得超9个赞
尝试这个
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,'https://www.instagram.com/p/CDq1KJPJcTN/?__a=1');
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl_handle, CURLOPT_HEADER, FALSE);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.47 Safari/537.36');
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
$query = curl_exec($curl_handle);
curl_close($curl_handle);
echo $query;
使用 file_get_contents 在本地对我有用
ini_set("allow_url_fopen", TRUE);
ini_set("allow_url_include", TRUE);
$context = [
'http' => [
'method' => 'GET',
'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.47 Safari/537.36',
],
];
$context = stream_context_create($context);
$data = file_get_contents('https://www.instagram.com/p/CDq1KJPJcTN/?__a=1', false, $context);
echo $data;
- 1 回答
- 0 关注
- 92 浏览
添加回答
举报