Current location: Hot Scripts Forums » Programming Languages » PHP » curl_init() not working

curl_init() not working

Reply
  #1 (permalink)  
Old 11-01-09, 02:49 AM
hemi hemi is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 60
Thanks: 3
Thanked 0 Times in 0 Posts
curl_init() not working

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(Example Web Page) [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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-01-09, 06:38 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 2,838
Thanks: 13
Thanked 11 Times in 10 Posts
Quote:
Originally Posted by hemi View Post
iam getting error for both the scripts
Call to undefined function curl_init() in C:\wamp\www\pdf\text.php on line 2
It looks like you don't have cURL enabled or compiled into your version of wamp. In other words, you either don't have cURL or it isn't configured.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data (scroll down)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-01-09, 10:58 PM
wirehopper's Avatar
wirehopper wirehopper is online now
Community Liaison
 
Join Date: Feb 2006
Posts: 1,565
Thanks: 2
Thanked 25 Times in 25 Posts
cURL error:

From: PHP: Installation - Manual

Note: Note to Win32 Users
In order to enable this module on a Windows environment, libeay32.dll and ssleay32.dll must be present in your PATH. You don't need libcurl.dll from the cURL site.

file_get_contents error:

The URL may not be responding well. You might want to try something other than http://example.com. It could also be that a firewall or other access issue was preventing the server from going out on the 'net.

Last edited by wirehopper; 11-01-09 at 11:00 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-02-09, 02:05 AM
hemi hemi is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 60
Thanks: 3
Thanked 0 Times in 0 Posts
;extension=php_curl.dll

i had uncommented the above line where ever required 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-02-09, 07:07 AM
Nico's Avatar
Nico Nico is online now
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 7,537
Thanks: 5
Thanked 20 Times in 18 Posts
Did you restart Apache after uncommenting this line?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Make Rewrite Modul Working in Windows, cause .htaccess ist not working specialex Web Servers 5 04-09-08 12:07 PM
JS script not working properly on IE but working on Firefox!!! sujata_ghosh JavaScript 4 05-21-07 06:46 AM
footer working in some browsers but not all pkcidstudio CSS 6 08-25-06 09:39 AM
[SOLVED] isLeapYear not working? viper2843 Everything Java 2 05-17-04 07:11 PM


All times are GMT -5. The time now is 07:50 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.