Jump to content
php.lv forumi
Sign in to follow this  


Recommended Posts

Visādi izmēģinājos, google arī šoreiz ne visai.



$ch = curl_init();

curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_URL, "http://example.lv/");
$dra = curl_exec ($ch);

//preg_match(etc and other stuff);
//$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: Gecko/20070309 Firefox/");
$es = curl_exec ($ch);	

echo $es;

Share this post

Link to post
Share on other sites

Šodien labs garīgais:




Nu, man jau ir viņš tā uzstādīts, bet no tā nekas nemainās


curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

Share this post

Link to post
Share on other sites

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

Share this post

Link to post
Share on other sites

Tātad, pareizi būtu:

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);






nu, bet izmet atkal:


301 Moved Permanently



Edited by who_i_am

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...