PDA

View Full Version : curl_init() not working



hemi
11-01-2009, 07:42 AM
iam getting error for both the scripts

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://google.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>

whn iam using this script iam getting an error

Call to undefined function curl_init() in C:\wamp\www\pdf\text.php on line 2

---------------------------------------------------------------------------------------


<?php
$file_contents = file_get_contents('http://example.com/');

// display file
echo $file_contents;
?>

----------------------------------------------------------
Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\pdf\text.php on line 2

Warning: file_get_contents(http://example.com/) [function.file-get-contents]: failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\pdf\text.php on line 2
-------------------------------------------------------------


allow_url_fopen is "on" in my phpinfo()

allow_url_include is "off" in my phpinfo()


or if u have any other that scripts tht works plz let me know

bluewalrus
11-01-2009, 08:32 AM
What version of php are you running?

hemi
11-02-2009, 04:49 AM
;extension=php_curl.dll

i had uncommented the above line but still iam getting same error

Call to undefined function curl_init() in C:\wamp\www\pdf\text.php on line 3

iam using php 5.2.8 version

djr33
11-02-2009, 11:54 AM
I'm not quite sure what you mean in the last post.

curl functions are an extension you must install-- see the instructions on php.net.

It sounds like you think they are installed, but if the function is not defined, then they must not be properly installed... check that again.