Page 1 of 1

PHP curl not working in browser

Posted: Wed Dec 30, 2009 10:35 pm
by ks.sundarrajan
I have a situation here....
the below is a simple curl script in php:

Code: Select all

 
$curl = curl_init();
echo $curl;
curl_setopt ($curl, CURLOPT_URL, "http://php.net");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
echo curl_exec ($curl);
curl_close($curl); 
 
This works perfectly when i run it in a command line like this - php test.php
I get the desired output.

But, if i access test.php file from the browser, i do not get any output.
http://localhost/test/test.php

I saw the logs, but there is nothing in it.

Should i do any apache settings to run curl?

Thanks,
Sundar