Solved

curl_exec returns nothing

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now