thats not how you use fsockopen()
please see the manual for more info, check out the user comments.
basically, you cant feed a full uri as the target parameter.
you need to feed it www.example.com and then you need to specify the path/filename as part of the headers, and you probably want to specify it as a GET(or preferably HEAD) request. then you need to parse the response headers to find the servers response code.
you could also just use fopen() and it would make it a lot simpler, although probably not as efficient.