I'm doing some screen scraping and the code has been written and works well except for one part. file_get_contents should open the webpages source into a string. But I can't get it to do anything.
<?php
$subject = file_get_contents('http://somesite.com/somepage.html');
echo $subject
This simple code won't echo anything. I read in the manual that I might need to use urlencode?
This is the code I'm using:
<?php
$subject = file_get_contents('http://mysite.com/membername.html');
$pattern = '#src\s*=\s*(["'])?[url]http://images.mysite.com/users/[/url]([^\s]*?)\\1#i';
preg_match($pattern, $subject, $matches);
echo "<pre>";
print_r($matches);
echo "</pre>";
?>
Hope someone can help, I can't figure out why it won't get the contents of the webpage with 'file_get_contents'.