Question : checking login & pass with curl

hi,
is it possible to check if login and password are correct using curl?
For example: user enter login and password on website A. Script checks if login and password match (on website B), and than return information if data are correct or not.

Answer : checking login & pass with curl

http://www.electrictoolbox.com/php-curl-sending-username-password/ has a good article on how to do this.

Use the code they suggested:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

and if you know some telling bit of source code in the page after the password was sent that differentiates a failed attempt from a successful one (for example if the login worked it may say "login successful"), and test the returned code.
Random Solutions  
 
programming4us programming4us