Solved

curl_exec returns nothing

Posted on 2008-10-20
3
1,373 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 250 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

860 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