Thanks; your code does give me the contents of www.mysite.com, and it seems to quit gracefully when mysite is down. However:
fsockopen('www.mysite.com/rss',...,...,..,)
always fails (returns false), while
$var=file_get_contents('http://www.mysite.com/rss')
works as expected (when mysite is up).
My idea was to test www.mysite.com with fsockopen, then if not down retrieve www.mysite.com/rss with file_get_contents.
I don't know how to make fsockopen accept www.mysite.com/rss, and I don't know if it's necessary. It would resolve my issue, using your approach and dropping file_get_contents, if I could make fsockopen accept the /rss too. I suspect there are other ways, possibly better. I would be happy, though, with this way of doing it.
This ought to be a fairly common problem, but I haven't yet found much info, possibly because I am unfamiliar with socket manipulation and can't interpret what I read.
What I want is simply the script to give up if it cannot read a page instantly.