Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

curl_exec returns nothing

Posted on 2008-10-20
3
Medium Priority
?
1,442 Views
Last Modified: 2008-10-20
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.
0
Comment
Question by:popolusiak
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 1000 total points
ID: 22760483
>>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.
0
 
LVL 8

Expert Comment

by:aldanch
ID: 22760566
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.
0
 

Author Comment

by:popolusiak
ID: 22762219
You are probably right.
They don't allow outbound connections.
CURL is enable.
Thanks for answers
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question