This is part of my code that I use to login on a webpage (links changed):
$curl = curl_init ();
curl_setopt ( $curl, CURLOPT_URL, "loginpage");
curl_setopt ( $curl, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $curl, CURLOPT_POST, 1 );
curl_setopt ( $curl, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $curl, CURLOPT_POSTFIELDS, "login=login&password=password");
curl_setopt ( $curl, CURLOPT_ENCODING, "" );
curl_setopt ( $curl, CURLOPT_COOKIEFILE, $_SERVER["DOCUMENT_ROOT"].'/web.cookies' );
curl_setopt ( $curl, CURLOPT_COOKIEJAR, $_SERVER["DOCUMENT_ROOT"].'/web.cookies' );
curl_setopt ( $curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)" );
curl_exec ( $curl );
curl_setopt ( $curl, CURLOPT_URL, "homepage");
$profilepage = curl_exec ( $curl );
The thing is, when I run
http://localhost/login.php
I can login and manage my web profile through my script.
The problem is, when I put all my scripts (including this one) on my external paid web server, ie.
http://myserver.com/login.php
I get a response from "loginpage" that "Cookies are not enabled".
What could possibly go wrong?