Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Fetch another sites HTML via cURL?

  • 28-09-2008 7:52pm
    #1
    Closed Accounts Posts: 94 ✭✭


    Hey,

    I'm trying to get my head around cURL.

    Basically, ATM, I'm just trying to grab the pages HTML.

    Can anyone give me a tip with starting this off?

    Thanks!


Comments

  • Closed Accounts Posts: 94 ✭✭gnomer


    Disregard this topic, I have solved it myself.

    file_get_contents($url);


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    Here's a good starting point on making sure curl is set up and working (read the comments)... http://ie.php.net/curl

    The most basic way to get something happening is this...
    [php]
    $url = "http://example.com";
    $handle = curl_init($url); //initialize
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); //makes curl_exec() return the contents of the url instead of just true or false (default)
    $contents = curl_exec($handle); //make curl go
    curl_close($handle); //clean up
    [/php]


Advertisement