Skip to content

Instantly share code, notes, and snippets.

@idhamperdameian
Created October 5, 2016 04:53
Show Gist options
  • Save idhamperdameian/7270cce4f468e81fe6e4244c32502f61 to your computer and use it in GitHub Desktop.
Save idhamperdameian/7270cce4f468e81fe6e4244c32502f61 to your computer and use it in GitHub Desktop.
Download using php file_get_contents
<?php
$opts = array(
'http'=>array(
'method'=> "GET",
'header'=> "Accept:*/*\r\n
Accept-Encoding:gzip, deflate, sdch\r\n
Accept-Language:en-US,en;q=0.8,id;q=0.6\r\n
Cache-Control:no-cache\r\n
Connection:keep-alive\r\n
Host:www.ligascore.com
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36\r\n"
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents('https://www.google.co.id/', false, $context);
echo $file;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment