Jump to content

Login to site using curl


suryab21

Recommended Posts

In my php project i am using curl to get login to anothere site but when i try to login to that site i get the Object moved error.The same code is working fine for other sites. here is my code

 

$url="http://www.firstpointinformationresources.com/Secure/login/trans/LoginProc.asp?count=0";

$ch = curl_init();

curl_setopt ($ch, CURLOPT_COOKIEJAR, '/cookies.txt');

curl_setopt($ch, CURLOPT_COOKIEFILE, '/cookies.txt');

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt ($ch, CURLOPT_POST, 1);

curl_setopt ($ch, CURLOPT_POSTFIELDS, "tbUserId=userid&tbPwd=password");

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_VERBOSE, 1);

curl_setopt($ch, CURLOPT_HEADER, 1);

curl_setopt($ch, CURLOPT_MAXREDIRS, 4);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

$store = curl_exec ($ch);

curl_close ($ch);

//print_r($content);

////////////////////////////////////

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://www.firstpointinformationresources.com/Secure/criminalSearch/trans/criminalSearchForm.asp?");

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

$data = curl_exec($ch);

curl_close ($ch);

 

 

what i am doing wrong??? is there anything that i need to add in my code??

Link to comment
https://forums.phpfreaks.com/topic/44326-login-to-site-using-curl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.