SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: curl

  1. #1
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    436
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    curl

    i want to grab some contents of a webpage,how shall i do it?someone told me use CURL,but i don't know how to use it.
    is there anyone can give me some tips.
    3Q.
    Outdoor tools online store and wargame tools shop
    with best quality and service.
    comp molle tactical vest tactical clothing etc sell

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    $rCurl 
    curl_init();
    $aCurlOptions = array(
        
    CURLOPT_URL                =>    'http://www.google.com/',
        
    CURLOPT_RETURNTRANSFER    =>    true
    );
    curl_setopt_array($rCurl$aCurlOptions);
    $sPageData curl_exec($rCurl);
    curl_close($rCurl);
    ?>
    $sPageData will hold the HTML for the indicated URL, in this case, Google.com.

    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    436
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    it doesn't work!
    the tip is:Parse error: parse error, expecting `')''
    i look for the error lots time,but can not find.where is the error?
    Outdoor tools online store and wargame tools shop
    with best quality and service.
    comp molle tactical vest tactical clothing etc sell

  4. #4
    SitePoint Addict
    Join Date
    Jun 2008
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no error when i executed the script

  5. #5
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Well, there isn't one.

    Are you modifying the code, if so, can you paste your code here?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  6. #6
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    436
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i didn't do a change,just copied and pasted. when i clicked the file,it appeared parse error.then i opened the file ,finding the file's code had been changed.
    is this true,where is the grabbed content?
    Outdoor tools online store and wargame tools shop
    with best quality and service.
    comp molle tactical vest tactical clothing etc sell


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
  •