[英]Instagram curl returns login page
我嘗試使用 Curl https://www.instagram.com/durov/?__a=1 。 瀏覽器打開頁面。 Postman 返回數據,但是當我嘗試使用 php curl 時 - 我收到空白頁。 有人知道如何解決嗎?
我的代碼:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.instagram.com/durov/?__a=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"postman-token: 406fa2df-4649-b3af-1fcb-806d9be8678f"
),
));
$data = curl_exec($curl);
$err = curl_error($curl);
為什么不只使用這一襯里?
file_get_contents('https://www.instagram.com/durov/?__a=1');
所以...
<?php
$json = file_get_contents('https://www.instagram.com/durov/?__a=1');
$array = json_decode($json, true);
var_dump($array); // Do anything you want with the data
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.