I'm trying to scrap with login and password,
I use this script to pass the login page :
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.cogedim-partenaire.com/extranet/cogedim_extranet_prod/verification_id.php"); //login URL
curl_setopt ($ch, CURLOPT_POST, 1);
$postData="login=XXX&mdp=XXX";
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
return $ch;
?>
In fact, my problem is that I do not manage to get cookie.txt on my server....
I checked the Chmod, and no problem with this,
However, I do not get the cookie after passing the login page...
Does somebody can help me ?
Many thanks,
Marc
Use absolute path for the cookie file instead of relative path. For example:
/tmp/curl/cookie.txt
Also, close your curl after the operation is finish.
curl_close($ch);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.