title: Get HTML Code of HTML File using PHP CURL
body: <p>I am working on a task of localserver 192.168.1.1. I want to fetch the data of a page </p>
  
  <blockquote>
    <p>192.168.1.1/userRpm/SystemStatisticRpm.htm?Num_per_page=100</p>
  </blockquote>
  
  <p>I want to display the HTML code returned by this file.</p>
  
  <p>When I am running curl command on terminal like
  <strong>curl -u admin:admin PageURL</strong> ( Its returning the code of page)</p>
  
  <p>But when I am using PHP curl then its redirecting me to 192.168.1.1</p>
  
  <p>Can anybody help me ?</p>
  
  <p>My code is :</p>
  
  <pre><code>&lt;?php
  $json_url="http://192.168.1.1/userRpm/SystemStatisticRpm.htm?Num_per_page=100";
  $username="admin";
  $password="admin";
  $ch=curl_init();
      curl_setopt($ch, CURLOPT_URL, $json_url);
      curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type:application/json')); 
      curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
      curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
  
    $result=curl_exec($ch);
    curl_close ($ch);
  </code></pre>