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&IDToken 2=pass&Go= Go&org=o2e xt&gx_char set=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,$POSTFI ELDS);
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.
there is a problem with redirect by curl. This is my script
$LOGINURL = "https://www.o2online.ie/amserver/UI/Login";
$POSTFIELDS = 'IDToken1=username&IDToken
$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,$POSTFI
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You are probably right.
They don't allow outbound connections.
CURL is enable.
Thanks for answers
They don't allow outbound connections.
CURL is enable.
Thanks for answers
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.