Jump to content
php.lv forumi

cURL


sandis_m

Recommended Posts

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;

Link to comment
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

Link to comment
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.

Guest
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.

Loading...
×
×
  • Create New...