For some reason I can't explain though, I can't seem to get the contents of the page using PHP. Here's my code:
Expand|Select|Wrap|Line Numbers
- $username = @$_GET['username'];
- if(!$username) {
- die("no username");
- }
- $url = "http://www.stickam.com/servlet/ajax/getLiveUser?uname=".$username;
- $html = file_get_contents($url, false, $context);
- echo "<pre>";
- echo $html;
- echo "</pre>";
Warning: file_get_contents(http://www.stickam.com/servlet/ajax/getLiveUser?uname=[username]) [function.file-get-contents]: failed to open stream: Connection timed out in [file] on line 7
I can load it just fine on my Apache server running on my personal computer, and I can load it in my browser (both IE9 and Firefox), but not on my website. I've tried mimicking the headers that my browser sends and creating a stream context to send with the file_get_contents() call, but so far nothing seems to work.
Any ideas?