curl_exec returns nothing

Hallo experts,
there is a problem with redirect by curl. This is my script
      $LOGINURL = "";
      $POSTFIELDS = 'IDToken1=username&IDToken2=pass&Go=Go&org=o2ext&gx_charset=UTF-8';
    $reffer = "";

      $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_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.
Who is Participating?
hieloConnect With a Mentor Commented:
>>I changed webhosting. The script works before
Not all webhosting companies allow outbound connections. You need to contact them and see if they allow outbound connections. If no, then you have reached a dead end. If yes, then you need to find out if they have curl enabled.
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.
popolusiakAuthor Commented:
You are probably right.
They don't allow outbound connections.
CURL is enable.
Thanks for answers
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.