I am trying to get access to a website through a login page.
I have been attempting to use curl to post the logonId and password. I have not be able to get anything that I have tried to work yet. Once I get logged into the site I want to be able to download a different page and store it in a database.
this is the code that I have been trying to use:
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookieFileName");
curl_setopt($ch, CURLOPT_URL,"https://mywebsite.com/logon.cfm?");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "LogonId=mylogonid&password=mypass");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
ob_start();
$buf2 = curl_exec ($ch);
ob_stop();
echo htmlentities($buf2);
curl_close ($ch);
unset($ch);
This functions keeps returning the logon.cfm page.
I am trying to retrieve the page that is display after the logon page to confirm that I did get logged into the site.
Any help would be greatly appreciated...I have been messing around with this for 2 days now (testing code, reading articles, messages, etc...)