Advertisement
yesamarcos

Get URL Html Content

Jan 29th, 2018
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2.  
  3. class Test extends CI_Controller {
  4.  
  5.     public function index(){
  6.         echo $this->html();
  7.     }
  8.  
  9.     private function html(){
  10.  
  11.         $c = curl_init('https://stackoverflow.com/questions/48512011/object-position-is-added-in-qs-stringify-result-express-nodejs-querystring');
  12.         curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  13.         //curl_setopt(... other options you want...)
  14.  
  15.         $html = curl_exec($c);
  16.  
  17.         if (curl_error($c))
  18.             die(curl_error($c));
  19.  
  20.         // Get the status code
  21.         $status = curl_getinfo($c, CURLINFO_HTTP_CODE);
  22.  
  23.         curl_close($c);
  24.         return $html;
  25.     }
  26. }
  27.  
  28. /* End of file Test.php */
  29. /* Location: ./application/controllers/Test.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement