login to any site using curl in php

Posted by user550265 on Stack Overflow See other posts from Stack Overflow or by user550265
Published on 2011-02-20T23:23:32Z Indexed on 2011/02/20 23:25 UTC
Read the original article Hit count: 196

Filed under:
|

login to a website using curl php

I have tried

$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.sitename.com"); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt'); curl_setopt($ch, CURLOPT_POSTFIELDS, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ); curl_setopt($ch, CURLOPT_USERPWD, "username:password"); curl_exec($ch); curl_close($ch); ?>

But this does not log in .

© Stack Overflow or respective owner

Related posts about php

Related posts about curl