Page 1 of 1

Unclosed Token Error

Posted: Wed Dec 30, 2009 6:46 pm
by jknudsen
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,

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;?>&deg;F</li>
    <li>Current Description: <?=$currentDescription;?></li>
</ul>
</body>
</html
 

Re: Unclosed Token Error

Posted: Thu Dec 31, 2009 9:56 am
by Weirdan
Please post the exact error message you're getting.