Results 1 to 4 of 4

Thread: curl_init() not working

  1. #1
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default 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(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
    Last edited by hemi; 11-01-2009 at 07:48 AM.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    What version of php are you running?

  3. #3
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default

    ;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
    Last edited by hemi; 11-02-2009 at 07:07 AM.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •