Print Friendly

Write following code and run

<?php
error_reporting(E_ALL);

ini_set(‘display_errors’, ‘1’);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
http://news.google.com/news?hl=en&topic=t&output=rss’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
echo $contents;
curl_close ($ch);
?>

If php_curl.dll does not work then error show
Fatal error: Call to undefined function curl_init() in ……………..”

You can also run following code in php script

<?php
phpinfo();
?>

If cURL enable on your server then you can see curl enable in phpinfo page.

If you install PHP, Apache in Windows operating system then following step can
help you to run php_curl.dll smoothly.

 

  1. find the location of php.ini (probably in c:/windows) file and open it.  then
    uncomment (remove semi-colon(;)  from ;extension=php_curl.dll ) the line.  and
    save the file
  2. copy php4ts.dll (if you use PHP4) or php5ts.dll (if you use PHP5),
    libeay32.dll and ssleay32.dll  to the C:/WINNT (Windows 2000) or C:/Windows
    (WindowsXP and 2003) directory. (if php4ts.dll or php5ts.dll not found in your
    computer thn search in google and download. other two dll can found in the dlls
    directory of your PHP directory(may be in c:/php/ext))
  3. restart Apache service.

check again that cURL is enable. if not then restart your computer.
Now run script again and see your php_curl is now working smoothly.
If not then,

copy above 3 dll file (describe in 2) to your php root directory (may be c:/php)
and also in windows system32 directory (c:/windows/system32)

Have a nice day…….

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *


*