Glad you solved your problem Barry. Its always doesn't hurt to post your solution in case anyone reading ur post wants to know as well.
The problem looks like it was in the line
$url = www.yahoo.com;
I'm guessing that once you put quotes around your URL string the problem was solved i.e.
$url = "www.yahoo.com";
In PHP, the . operator is used for string concatenation. So the code $url = www.yahoo.com will concatenate the 3 strings "www", "yahoo", "com" into one string forming "wwwyahoocom". But if the . lies inside quotes, it is treated literally, so problem solved.