©想用php curl登錄instagram。當我嘗試登錄下面的代碼永遠是那麼的改變,我必須得到這個輸入值:如何通過php curl獲得輸入值?
<input type="hidden" name="csrfmiddlewaretoken" value="uCbmYHcQLe18VAvVFXbfyPcS5kXtCuuE">
我捲曲的代碼是:現在
$veri = curl_exec($curl); // That $veri contains the curl response into it
$data = json_decode($veri, true); // Convert the response into an array
的$data
:
<?php
$url = "https://www.instagram.com/accounts/login/?force_classic_login";
$values = "csrfmiddlewaretoken=" + $key + "&username=myusername&password=mypassword";
$key = "";
//foreach input name csrfmiddlewaretoken = $key
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $values);
$veri = curl_exec($curl);
curl_close($curl);
echo $veri;
?>
我不明白。你能寫出完整的代碼嗎? –