if you want to login to my site to see the errors you can at 99.20/131.64/login.html
it is the first submit button. This is the first error but it repeats for every address point. Php script sends an address string to addAddress(). Notice the var_dump of $results. It is a 3 dimension array with resultset, results and address. The $results var has a function which sends the $addressdata to an xmltoparser which gets the input from yahoo also it is where the undefined $validPoint is. How do I define the $validPoint so this thing works? If you notice it gets the latitude and longitude from yahoo.
Thanks, inclosed is both functions, any help is appreciated. JaNIS
Notice: Undefined property: PhoogleMap::$validPoints in /Library/WebServer/Documents/phoogle1.php on line 54
string(34) "3537 3rd St, Ridgefield, WA, 98642" address
array(1) { ["ResultSet"]=> array(1) { ["Result"]=> array(7) { ["Latitude"]=> string(9) "45.813747" ["Longitude"]=> string(11) "-122.713689" ["Address"]=> string(14) "3537 S 3rd Way" ["City"]=> string(10) "Ridgefield" ["State"]=> string(2) "WA" ["Zip"]=> string(10) "98642-5407" ["Country"]=> string(2) "US" } } } results
function addAddress($address,$htmlMessage=null){
if (!is_string($address)){
die("All Addresses must be passed as a string");
}
var_dump($address);
echo "address"."\n\n"."<p>";
$apiURL = "http://local.yahooapis.com/MapsService/V1/geocode?appid=DoO9dXzV34FMVcI3aXjfoWLtUj_UBTBW4ltfKXiEDnXMnbm2DJ__79_Aw.n3EA--&location=";
$addressData = file_get_contents($apiURL.urlencode($address));
$results = $this->xml2array($addressData);
var_dump($results);
echo "results"."\n\n"."<p>";
if (empty($results['ResultSet']['Result']['Address'])){
$pointer = count($this->invalidPoints);
$this->invalidPoints[$pointer]['lat']= $results['ResultSet']['Result']['Latitude'];
$this->invalidPoints[$pointer]['long']= $results['ResultSet']['Result']['Longitude'];
$this->invalidPoints[$pointer]['passedAddress'] = $address;
$this->invalidPoints[$pointer]['htmlMessage'] = $htmlMessage;
}else{
$pointer = count($this->validPoints);
$this->validPoints[$pointer]['lat']= $results['ResultSet']['Result']['Latitude'];
$this->validPoints[$pointer]['long']= $results['ResultSet']['Result']['Longitude'];
$this->validPoints[$pointer]['passedAddress'] = $address;
$this->validPoints[$pointer]['htmlMessage'] = $htmlMessage;
}
}
function xml2array($xml){
$this->depth=-1;
$this->xml_parser = xml_parser_create();
xml_set_object($this->xml_parser, $this);
xml_parser_set_option ($this->xml_parser,XML_OPTION_CASE_FOLDING,0);//Don't put tags uppercase
xml_set_element_handler($this->xml_parser, "startElement", "endElement");
xml_set_character_data_handler($this->xml_parser,"characterData");
xml_parse($this->xml_parser,$xml,true);
xml_parser_free($this->xml_parser);
return $this->arrays[0];
}
function startElement($parser, $name, $attrs){
$this->keys[]=$name;
$this->node_flag=1;
$this->depth++;
}
function characterData($parser,$data){
$key=end($this->keys);
$this->arrays[$this->depth][$key]=$data;
$this->node_flag=0;
}
function endElement($parser, $name)
{
$key=array_pop($this->keys);
if($this->node_flag==1){
$this->arrays[$this->depth][$key]=$this->arrays[$this->depth+1];
unset($this->arrays[$this->depth+1]);
}
$this->node_flag=1;
$this->depth--;
}