0

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?

Sates
  • 408
  • 1
  • 5
  • 21
  • Is your COOKIEFILE and COOKIEJAR path writeable on your other server? – James Binford Dec 18 '13 at 19:57
  • It is, it's chmoded with 777. – Sates Dec 18 '13 at 20:04
  • 1
    You asked this exact question from a different account two days ago, or deleted it from your account as I can't find any trace of my response to that old one. Why re-ask it? (either way - see this response, because I'm not rewriting mine - http://stackoverflow.com/a/8961232/455008) – Connor Tumbleson Dec 18 '13 at 20:07
  • Simply because it was not solved or helpful at all. You probably do notice that your solution is included in the code here. – Sates Dec 18 '13 at 20:14

0 Answers0