@get__file_contents -- doesn't like redirects!

I have a service which requires people to have certain code on their website. Each time someone submits their website to my service, I use

@file_get_contents

…and then I scan over their HTML with more PHP to see if “zeriouz partners” is present.

However, there’s one problem with that method. Some of the websites have a redirect. So if they type in www.website.com – and then their URL redirects to [URL=“http://www.website.com/index.php”]www.website.com/index.php – my little scrtipt can’t read the HTML to see if “zeriouz partners” is present.

So, I am wondering, is there a way to check the “redirected” page?

@file_get_contents has a coronary if there’s no actual HTML on the “exact” URL you ask it to look at.

Maybe I could put a few lines of PHP code in my script first

– Look at where the redirect “GOES” (first) and make that:

$domain

– Then use:

$page = @file_get_contents($domain);

I’ve been trying to work out how to solve this problem for days. I can’t figure out a way to allow @file_get_contents to handle redirects.

Additionally, maybe I am just going the wrong way about it from the get go. If you know another (better) wa to check if “zeriouz partners” is on a page, feel free to let me know!

Use curl instead and tell it to follow location headers (redirects).

$c = curl_init(); 
curl_setopt($c, CURLOPT_URL, "http://www.example.com/");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); 
$html = curl_exec($c);
curl_close($c);

It would probably help if you did not suppress the error…
What I mean is, remove the At sign (@) prefixing the function.