Hi All,
Im new to this forum and trying to use the Place finder api to extract the zip + 4 postal code for a given stree address..
Im struggling with how to refer to parts of the array that is returned with unserialize. How do I extract a part of that, for instance the postal code?
Thanks
Dave Taylor
<!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>Untitled Document</title>
</head>
<?php
// Parsing Yahoo! REST Web Service results using
// unserialize. PHP4/PHP5
// Author: Jason Levitt
// February 1, 2006
error_reporting(E_ALL);
// output=php means that the request will return serialized PHP
$request = 'http://where.yahooapis.com/geocode?location=someaddress&flags=P&appid=someid';
$response = file_get_contents($request);
if ($response === false) {
die('Request failed');
}
$phpobj = unserialize($response);
// here is the problem..
foreach ($phpobj as &$value) {
print ' <br> x <br> '. $value ;
}
// for debug
echo '<pre>';
print_r($phpobj);
echo '</pre>';
?>
<body>
</body>
</html>
by
0 Replies