Skip to content

Instantly share code, notes, and snippets.

@suconghou
Created July 11, 2017 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suconghou/e0bb202cdb8344105a4287e8eca8d12e to your computer and use it in GitHub Desktop.
Save suconghou/e0bb202cdb8344105a4287e8eca8d12e to your computer and use it in GitHub Desktop.
fetch domain resource use given host
<?php
$opts = stream_context_create(array(
'http'=> array(
'method' => 'GET',
'header'=> "Host: www.oschina.net\r\nUser-Agent: my file_get_contents use host\r\n",
)
));
$url = "http://125.39.6.163/news/86646/lftp-4-8-0";
echo file_get_contents($url, null, $opts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment