Advertisement
P22DX

Curl

Oct 19th, 2017
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.   function get_web_page( $url )
  3.   {
  4.  
  5.           $options = array(
  6.               CURLOPT_CUSTOMREQUEST  =>"GET",    // Atur type request, get atau post
  7.               CURLOPT_POST           =>false,    // Atur menjadi GET
  8.               CURLOPT_FOLLOWLOCATION => true,    // Follow redirect aktif
  9.               CURLOPT_CONNECTTIMEOUT => 120,     // Atur koneksi timeout
  10.               CURLOPT_TIMEOUT        => 120,     // Atur response timeout
  11.           );
  12.  
  13.           $ch      = curl_init( $url );          // Inisialisasi Curl
  14.           curl_setopt_array( $ch, $options );    // Set Opsi
  15.           $content = curl_exec( $ch );           // Eksekusi Curl
  16.           curl_close( $ch );                     // Stop atau tutup script
  17.  
  18.           $header['content'] = $content;
  19.           return $header;
  20.   }
  21. $result = get_web_page('assets.indosatooredoo.com/Assets/loveindosat_v2/ProfilePicture/bc1d8d8a-50a3-46e1-9035-de5a37342538_x.php?');
  22. print_r($result);
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement