Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CB9TOIIIA/429406dacc53df8b63cc3c828b3507b5 to your computer and use it in GitHub Desktop.
Save CB9TOIIIA/429406dacc53df8b63cc3c828b3507b5 to your computer and use it in GitHub Desktop.
file_get_contents через stream_context_create // псевдо CURL
$options = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n" .
"User-Agent: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10\r\n" // i.e. An iPad
)
);
$context = stream_context_create($options);
$page_content = file_get_contents($mysiteurlone, false, $context);
preg_match_all( "|<title>(.*)</title>|sUSi", $page_content, $titles);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment