Hey all,
Having some problems again. I have a login page that I'm trying to get to (and use) with cURL. Problem is that it won't login, and I'm blaming it on the cookies. I can go to the URL in my browser and it's fine, but for whatever reason, it doesn't work from my cURL script. It's also important to note that if I make my own login form, it'll work. But if I put that login form inside of an <iframe> on a webpage, it won't work.
Here's my code:
<?
$ch = curl_init("http://www.xxxxx.net/cgi-bin/xxxxx/login.cgi?id=xxxx&pw=xxxx");
$fp = fopen("get.txt", "w");curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0");
curl_setopt($ch, CURLOPT_COOKIE, 'id=xxxx; pw=xxxx');
curl_setopt($ch, CURLOPT_COOKIEJAR, "curlcook.txt");curl_exec($ch);
curl_close($ch);
fclose($fp);
include "get.txt";
?>
By the way, I'm not sure if the information being written to the cookie (in line curl_setopt($ch, CURLOPT_COOKIE, 'id=xxxx; pw=xxxx'); ) is necessary. Thanks...
edit: also note that creating a link to the URL in an HTML document will work fine.