mangambil isi content dari url luar, atau dengan istilah lain meng-grab content dari website lain
curl($url, $param=array(), $option=array(), $is_debug = false);
$url = 'http://anydomain.ltd/any/path'; $post = array( 'username' => 'my_username', 'password' => 'my_secret' ); $header = array( 'CURLOPT_USERAGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Safari/605.1.15' ); $output = $sys->curl($url, $post, $header);
CURLOPT_HTTPHEADER
jadi anda perlu untuk meng-encode
$url = 'http://anydomain.ltd/any/path'; $post = array( 'username' => 'my_username', 'password' => 'my_secret' ); $header = array( 'CURLOPT_USERAGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Safari/605.1.15', 'CURLOPT_HTTPHEADER' => array( 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-US,en;q=0.5', 'Accept-Encoding: gzip, deflate', 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Keep-Alive: 300', 'Connection: keep-alive', 'Content-Type: application/x-www-form-urlencoded') ); $header['CURLOPT_HTTPHEADER'] = urlencode_r($header['CURLOPT_HTTPHEADER']); $output = $sys->curl($url, $post, $header);
$output = $sys->curl($url, $post, 1);
File Path: includes/system/bbcsystem.php file untuk routing dalam framework, sudah dipanggil secara otomatis dan masuk ke dalam variable $sys yang akan menjadi variable global
0 Comment
Post Your Comment