Unclosed Token Error
Posted: Wed Dec 30, 2009 6:46 pm
I'm pretty new when it comes to PHP. I'm trying to get a basic weather script setup for my Polycom phone. But I'm getting a "unclosed token" error on line 15. Please help, I've been tearing my hair out over this.
Thanks,
Thanks,
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Yahoo! Weather API RSS</title>
<?php
function retrieveYahooWeather($zipCode="92832") {
$yahooUrl = "http://weather.yahooapis.com/forecastrss";
$yahooZip = "?p=$zipCode";
$yahooFullUrl = $yahooUrl . $yahooZip;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$yahooFullUrl);
curl_setopt($curl, CURLOPT_HEADER,false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$returnYahooWeather = curl_exec($ch);
curl_close($ch);
return $returnYahooWeather;
}
$localZipCode = "92352"; // Lake Arrowhead, CA
$weatherXmlString = retrieveYahooWeather($localZipCode);
$weatherXmlObject = new SimpleXMLElement($weatherXmlString);
$currentCondition = $weatherXmlObject->xpath("//yweather:condition");
$currentTemperature = $currentCondition[0]["temp"];
$currentDescription = $currentCondition[0]["text"];
?>
</head>
<body>
<h1>Lake Arrowhead, California</h1>
<ul>
<li>Current Temperature: <?=$currentTemperature;?>°F</li>
<li>Current Description: <?=$currentDescription;?></li>
</ul>
</body>
</html