Im trying to login to my useraccount on a site i use to download files from so i can automatically grab the file without me having to visit the site.
This is
$postdata = "username=".$username."&userpass=".$password";
change to:
$postdata = "username=".$username."&userpass=".$password;
And also do you have this like this?
$url="http://www.yourdomain.com/news.php";
Also add this curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);.
And also this may help:
$headers = array();
$headers[] = 'application/xhtml+voice+xml;version=1.2, application/x-xhtml+voice+xml;version=1.2, text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1';
$headers[] = 'Connection: Keep-Alive';
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($ch, CURLOPT_HEADER, 1);