• Get full webpage from head as well as body using Curl in PHP

    It is very useful if we get any webpage from head as well as body in PHP using Curl. Here, You can derived it by follows the below easy steps :

    Let’s get started:

    Step 1 : Create a PHP file and put below code in it.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
     
    <?php
     
    $curl = curl_init('http://example.com'); // replace this URL with your webpage
    curl_setopt($curl, CURLOPT_FAILONERROR, true); 
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); 
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);   
    $result = curl_exec($curl); 
    echo $result; 
    ?>

    Now, run your php file as created in above steps, by that you will found whole webpage from head as well as body.

Comments on this post

Leave a Reply

  • Security Code :


    5 − = one