Created
February 13, 2011 18:22
-
-
Save xqus/824914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Set up array with options for the context used by file_get_contents(). */ | |
$opts = array( | |
'http'=>array( | |
'method'=>"GET", | |
'header'=>"Accept-language: en\r\n" . | |
"User-Agent: phpSec (http://phpsec.xqus.com)\r\n" | |
) | |
); | |
/* Create context. Allowing us to specify User-Agent. */ | |
$context = stream_context_create($opts); | |
/* Get data from remote server. */ | |
$data = file_get_contents('http://example.com', null, $context); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment