Files
Testing/grabzips.php

88 lines
3.2 KiB
PHP
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
<?php
/* $Id: profile.php 42 2009-01-29 04:55:14Z john $ */
$page = "generalplugin";
include "header.php";
header("Expires: Sat, 1 Jan 2005 00:00:00 GMT");
header("Last-Modified: ".gmdate( "D, d M Y H:i:s")."GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//$database->database_select("bateworldcom_zips");
/*$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "http://zipcodedistanceapi.redline13.com/rest/Y8sjPQoIdURuJfJg42ftvw9pnwNVtCGrL9LAZ9jc4aHNpq4tsjXXP6ndDb87NOyz/radius.xml/19971/25/mile");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
*/
$output=file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?latlng=".$_GET["lat"].",".$_GET["long"]."&sensor=true");
//$zip=xmlstr($ex[1], '<type>country</type> <type>political</type> </address_component> <address_component> <long_name>', "</long_name>");
$response_a = json_decode($output);
$zipcode= $response_a->results[0]->address_components[7]->short_name;
var_dump($response_a->results[0]->address_components[7]);//->geometry->location->lat;
//exit;*/
$output=file_get_contents("http://zipcodedistanceapi.redline13.com/rest/Y8sjPQoIdURuJfJg42ftvw9pnwNVtCGrL9LAZ9jc4aHNpq4tsjXXP6ndDb87NOyz/radius.xml/".$zipcode."/25/mile");
$explode=explode('<zip_code', $output);
echo $zipcode;
$t=1;
while($t<count($explode))
{
$zip=html_entity_decode(xmlstr($explode[$t], '">', "</zip_code>"));
echo $zip."<br />";
//echo html_entity_decode(xmlstr($explode[$t], '">', "</zip_code>"))."<br />";
$t++;
/*
$query=$database->database_query("SELECT country_code, place_name, admin_name1, admin_code1, postal_code, ( 3959 * acos( cos( radians(".$_GET["lat"].") )
* cos( radians( latitude ) ) * cos( radians( longitude ) - radians(".$_GET["long"].") )
+ sin( radians(".$_GET["lat"].") ) * sin( radians( latitude ) ) ) )
AS distance FROM bateworldcom_zips.zipcodes HAVING distance < 25
ORDER BY distance ASC LIMIT 0 , 1000");
while($row=$database->database_fetch_array($query))
{*/
if(trim($zip)!=""){
$query1=$database->database_query("SELECT * FROM se_users, se_profilevalues WHERE se_users.user_id=se_profilevalues.profilevalue_user_id AND se_profilevalues.profilevalue_27='".$zip."'");
while($row1=$database->database_fetch_array($query1))
{
$owner1 = new SEUser(Array($row1["user_id"]));
?>
<div class="browse_result" style="float: left; padding: 5px; width: 90px; height: 100px; text-align: center;">
<a href="http://bateworld.com/profile.php?user=<?=$row1["user_username"]?>"><img src="<?=$owner1->user_photo('./images/nophoto.png', TRUE)?>" class="photo" style="display: block; margin-left: auto; margin-right: auto;" width="60" height="60" border="0" alt="<?=$row1["user_username"]?>'s Profile"><?=substr($row1["user_username"],0,10)?></a>
</div>
<?
//<div style="margin-top: 3px;"><!--<img src='./images/icons/online16.gif' border='0' class='icon2'>-->Online</div>
}
}
}
?><div class="clear"></div><?
exit;
?>