sandis_m Posted February 12, 2011 Report Share Posted February 12, 2011 Kā apiet "301 Moved Permanently" ? Respektīvi, kā jāuzstāda CURLOPT attiecībā uz šo. Quote Link to comment Share on other sites More sharing options...
briedis Posted February 13, 2011 Report Share Posted February 13, 2011 Nebija kaut kāds headers follow? Google tiešām nesniedz atbildi? Quote Link to comment Share on other sites More sharing options...
sandis_m Posted February 13, 2011 Author Report Share Posted February 13, 2011 Visādi izmēģinājos, google arī šoreiz ne visai. $ch = curl_init(); //get curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_URL, "http://example.lv/"); $dra = curl_exec ($ch); //preg_match(etc and other stuff); //array_shift($matches); //#print_r($matches); //$pwn = $matches[0]; curl_setopt($ch, CURLOPT_URL, "http://example.lv/index.php"); curl_setopt ($ch, CURLOPT_POSTFIELDS, "redir=%2F&email=". urlencode($em) ."&$password=". urlencode($pass) ."&login=go"); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"); $es = curl_exec ($ch); echo $es; Quote Link to comment Share on other sites More sharing options...
briedis Posted February 13, 2011 Report Share Posted February 13, 2011 un tiešām manuālī arī nekā nav? http://www.php.net/manual/en/function.curl-setopt.php Quote Link to comment Share on other sites More sharing options...
marrtins Posted February 13, 2011 Report Share Posted February 13, 2011 Šodien labs garīgais: CURLOPT_FOLLOWLOCATION << TRUE Quote Link to comment Share on other sites More sharing options...
sandis_m Posted February 13, 2011 Author Report Share Posted February 13, 2011 Šodien labs garīgais: CURLOPT_FOLLOWLOCATION << TRUE Nu, man jau ir viņš tā uzstādīts, bet no tā nekas nemainās curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); Quote Link to comment Share on other sites More sharing options...
bubu Posted February 13, 2011 Report Share Posted February 13, 2011 who_i_am: lasi uzmanīgāk manuāli: value should be a bool for the following values of the option parameter:... CURLOPT_FOLLOWLOCATION TRUE to follow any "Location: " header that the server sends as part of the HTTP header iespējams, ka tāpēc arī nestrādā. 1 !== TRUE Quote Link to comment Share on other sites More sharing options...
sandis_m Posted February 13, 2011 Author Report Share Posted February 13, 2011 (edited) Tātad, pareizi būtu: curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); ? -- nu, bet izmet atkal: 301 Moved Permanently nginx/0.9.2 Edited February 13, 2011 by who_i_am Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.