0
我一直在圍繞這個網站尋找解決我的問題,一些答案看起來接近,但沒有那麼多,找到解決我的問題 我有PHP捲曲登錄到特定的網站,並重定向到一定聯繫,而登錄。簡單的捲曲重定向
***First to log:***
$ ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https >somesite');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $uagent);
curl_setopt($ch, CURLOPT_REFERER, 'some other site');
curl_setopt($ch, CURLOPT_TIMEOUT, 220);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).DS.'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).DS.'cookies.txt');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,'userid='.$log.'&password='.$pass.);
$content = curl_exec($ch)
***then run this to get away from page with ads ***
$info = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$fnd='ads'; ***// check to see if has ads***
$pos=strpos($info, $fnd);
if ($pos!==false)
{
$url1 = "https - link to redirect while logged id"; // ***I have this link for sure***
$ch1 = curl_init();
curl_setopt ($ch1, CURLOPT_URL, $url1);
curl_setopt ($ch1, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch1, CURLOPT_USERAGENT, $uagent);
curl_setopt($ch1, CURLOPT_HEADER, 1);
curl_setopt ($ch1, CURLOPT_COOKIESESSION, 0);
curl_setopt ($ch1, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch1, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch1, CURLOPT_CONNECTTIMEOUT ,100);
curl_setopt ($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch1, CURLOPT_COOKIEJAR, dirname(__FILE__).DS.'cookies.txt');
curl_setopt ($ch1, CURLOPT_COOKIEFILE, dirname(__FILE__).DS.'cookies.txt');
curl_setopt ($ch1, CURLOPT_POST, 0);
$content = curl_exec ($ch1);
但這是行不通的。
誰會可否回答我?
謝謝。
你能更多地討論「不靈」了一下?例如,你有錯誤嗎? – Martijn