Link to home
Start Free TrialLog in
Avatar of popolusiak
popolusiak

asked on

curl_exec returns nothing

Hallo experts,
there is a problem with redirect by curl. This is my script
      $LOGINURL = "https://www.o2online.ie/amserver/UI/Login";
      $POSTFIELDS = 'IDToken1=username&IDToken2=pass&Go=Go&org=o2ext&gx_charset=UTF-8';
    $reffer = "https://www.o2online.ie/amserver/UI/Login";

      $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$LOGINURL);
      curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
      curl_setopt($ch, CURLOPT_REFERER, $reffer);
      curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
      curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
  curl_exec ($ch);
  curl_close ($ch);

Cookies are writen correctly in $cookie_file_path file but curl_exec returns nothing.
I changed webhosting. The script works before. I dont know what is wrong.
Please help.
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Exactly what hielo said!

You can check for CURL yourself by writing a small script like:

<?

echo phpinfo();

?>

Look for CURL.

I assume CURL is enabled since you didn't get an error... and since the cookie was written.
Avatar of popolusiak
popolusiak

ASKER

You are probably right.
They don't allow outbound connections.
CURL is enable.
Thanks for answers