title: Did not getting data from URL using cUrl?
body: <pre><code>&lt;?php
      $con=mysql_connect("localhost","root","");
      mysql_select_db("google",$con);
  
      $sql="SELECT urlname FROM url WHERE id=12";
      $url=mysql_query($sql);
      $result = get_web_page( $url );
  
      if ( $result['errno'] != 0 ) {
          echo "errror";
      }
  
      if ( $result['errmsg'] != 200 ) {
          echo "error";
      }
  
      $page = $result['content'];
      while ($row = mysql_fetch_array($page)) {
          printf($row[0]);  
      }
  
      function get_web_page( $url1 )
      {
          $options = array(
              CURLOPT_RETURNTRANSFER =&gt; true,     // return web page
              CURLOPT_HEADER         =&gt; false,    // don't return headers
              CURLOPT_FOLLOWLOCATION =&gt; true,     // follow redirects
              CURLOPT_ENCODING       =&gt; "",       // handle all encodings
              CURLOPT_USERAGENT      =&gt; "spider", // who am i
              CURLOPT_AUTOREFERER    =&gt; true,     // set referer on redirect
              CURLOPT_CONNECTTIMEOUT =&gt; 120,      // timeout on connect
              CURLOPT_TIMEOUT        =&gt; 120,      // timeout on response
              CURLOPT_MAXREDIRS      =&gt; 10,       // stop after 10 redirects
          );
  
          $ch = curl_init( $url1 );
          // create a new cURL resource
          //$ch    = curl_init();
  
          // set URL and other appropriate options
          curl_setopt($ch, CURLOPT_URL,$url1);
          curl_setopt($ch, CURLOPT_HEADER, 0);
  
          curl_setopt_array( $ch, $options );
          $content = curl_exec( $ch );
          $err     = curl_errno( $ch );
          $errmsg  = curl_error( $ch );
          $header  = curl_getinfo( $ch );
          curl_close( $ch );
  
          $header['errno']   = $err;
          $header['errmsg']  = $errmsg;
          $header['content'] = $content;
          return $header;
      }
  ?&gt;                      
  </code></pre>
  
  <p>Here is my php code and when I echo <strong>$page</strong> I am getting following warning and error as well as did not getting any data from the requested url.</p>
  
  <p>Warnings:</p>
  
  <blockquote>
    <p>Warning: curl_init() expects parameter 1 to be string, resource given
    in C:\xampp\htdocs\CSE391\curl.php on line 36</p>
    
    <p>Warning: curl_setopt_array(): supplied argument is not a valid cURL
    handle resource in C:\xampp\htdocs\CSE391\curl.php on line 37</p>
    
    <p>Warning: curl_exec() expects parameter 1 to be resource, null given in
    C:\xampp\htdocs\CSE391\curl.php on line 38</p>
    
    <p>Warning: curl_errno() expects parameter 1 to be resource, null given
    in C:\xampp\htdocs\CSE391\curl.php on line 39</p>
    
    <p>Warning: curl_error() expects parameter 1 to be resource, null given
    in C:\xampp\htdocs\CSE391\curl.php on line 40</p>
    
    <p>Warning: curl_getinfo() expects parameter 1 to be resource, null given
    in C:\xampp\htdocs\CSE391\curl.php on line 41</p>
    
    <p>Warning: curl_close() expects parameter 1 to be resource, null given
    in C:\xampp\htdocs\CSE391\curl.php on line 42 error</p>
  </blockquote>