Well that did not work, I recieved 3,000 queries this morning and I
was shut down again!
I really need to fix this asap. Please take a look at the code below
and let me know if you see anything that is obviously wrong please.
<?
//## bgn Search GB
----------------------------------------------------------------------------------------------
include "inc/class.xml.php";
include "inc/_commonfunctions.php";
if ($_GET["q"] != ''){
$sAddress = $_GET["q"];
if ($_GET['within'] == ''){
$sLoc = urlencode('[location: @"'.$sAddress.'" +
50mi]');
}else{
$sLoc = urlencode('[location: @"'.$sAddress.'" +
'.$within.'mi]');
}
}
if ($priceTo == "")
$priceTo = "999999999";
if ($priceFrom == "")
$priceFrom = "1";
if ($priceFrom != 0 && $priceTo != 0){
$price = urlencode("[price: ".$priceFrom."..".$priceTo." USD]");
}
$sBathroom = ($sBathroom) ? urlencode("[bathrooms >= ".
$sBathroom."]"):"";
$sBedroom = ($sBedroom) ? urlencode("[bedrooms >= ".
$sBedroom."]"):"";
$propertyTypeStr = '';
if (count($propertyType) == 0){
$propertyTypeStr = '';
}else{
$propertyTypeStr = '[property type:';
for ($i=0; $i<count($propertyType); $i++) {
#echo "$i - $propertyType[$i],"; #
if ($i > 1){$propertyTypeStr .= '|';}
$propertyTypeStr .= $propertyType[$i];
}
$propertyTypeStr .= ']';
}
#echo "<hr>Property Type:".$propertyTypeStr."<hr>";
$propertyTypeStr = urlencode($propertyTypeStr);
$listingTypeStr = '';
if (count($listingType) == 0){
$listingTypeStr = '';
}else{
$listingTypeStr = '[listing type:';
for ($i=0; $i<count($listingType); $i++) {
#echo "$i - $listingType[$i],"; #
if ($i > 1){$listingTypeStr .= '|';}
$listingTypeStr .= $listingType[$i];
}
$listingTypeStr .= ']';
}
#echo "<h >listing Type:".$listingTypeStr."<hr>";
$listingTypeStr = urlencode($listingTypeStr);
$sFilterUrl = '&q=-propertynet.com';
if (!$_GET['order'] or $_GET['order']=='price_desc')
$sOrder = '&orderby='.urlencode('price(float
USD)').'&sortorder=descending';
elseif ($_GET['order']=='price_asc')
$sOrder = '&orderby='.urlencode('price(float
USD)').'&sortorder=ascending';
$iRowsPerPage = 1;//set to 1 so that retrived data is too small
$sXmlUrl = 'http://www.google.com/base/feeds/snippets/-/housing?'
.'bq='. $sLoc.$sPriceRange.$sBathroom.$sBedroom
#.urlencode('[image_link]')
.$propertyTypeStr
.$listingTypeStr
.$price
.'&max-results=25'
.'&start-index='.$startindex.$sFilterUrl.$sOrder
.'&key=ABQIAAAA2gq7Hbm8Qq9m7x3WTSSboxQ...cqCFfQB9Aw';
#.'&crowdby=location(text):1';
#&content=geocodes
/*if ($_GET['show_xml_url']==1) {
echo "<hr><a href='".$sXmlUrl."' target=\"_blank\">Google Base
Snippet Search</a><hr>";
}*/
$sXmlOut = file_get_contents($sXmlUrl);
$oXml = new XML2Array();
$aXml = $oXml->ParseXML($sXmlOut);
$iTotalRows_GB = $TOTALRESULTS = AssignProperty($aXml[0]["children"],
"OPENSEARCH:TOTALRESULTS");
//## end Search GB
----------------------------------------------------------------------------------------------
?>
ERROR =
Warning: file_get_contents(http://www.google.com/base/feeds/snippets/-/
housing?bq=%5Blocation%3A+%40%22Spokane+Washington%22+%2B+5mi%5D
%5Bprice%3A+1..999999999+USD%5D&max-results=25&start-index=1&q=-
propertynet.com&orderby=price%28float+USD
%29&sortorder=descending&key=ABQIAAAA2gq7Hbm8Qq9m7x3WTSSboxQS_tGb29H7YG-
S9HZO4R09DIw8tBTVJS5SH5tWOje_ReWDcqCFfQB9Aw) [function.file-get-
contents]: failed to open stream: HTTP request failed! HTTP/1.0 403
Forbidden in /var/www/vhosts/shortsign.com/httpdocs/results.php on
line 327
LINE 327 = $sXmlOut = file_get_contents($sXmlUrl);
On May 20, 4:12 pm, Tom Wilson <[email protected]> wrote:
> The snippets feed doesn't require authentication but you can sign
> (label) requests from an API Key.
>
> Google monitor these type of requests and work with publishers to make
> sure Google Base is working effectively for them.
>
> See Jeff (a Google Employees) comments here about limits and usage
> :http://groups.google.com/group/Google-Base-data-API/browse_thread/thr...
>
> I think from this we can take that they actively montior API requests
> based on the API Key and if someone is having problems they adjust the
> limits for that API Key.
>
> To use this you simple stick a key=YOUR API KEY on the end of requests
> so for example :
>
> http://www.google.com/base/feeds/snippets/-products/?bg=ipod&key=YOUR
> API KEY
>
> You can signup for your key here :http://code.google.com/apis/base/signup.html
>
> On May 20, 11:57 pm, CArealtorGuy <[email protected]> wrote:
>
> > That would not be an issue as I am using a snippet just like on your
> > site and you are not authenticating
>
> > On May 15, 9:00 am, Tom Wilson <[email protected]> wrote:
>
> > > There is a limit of 5 queries per second maybe but signing each
> > > request might help and also tell Google which accounts are high users
> > > sometimes they increase your alllowance/limit.
>
> > > On May 14, 10:15 pm, CArealtorGuy <[email protected]> wrote:
>
> > > > Hello Tom,
>
> > > > I just checked and I am not using an API key for some reason?!
>
> > > > I currently am getting about 4k queries a day.
>
> > > > If I add the API code will it stop erroring? It is odd it normally
> > > > stalls for a couple hours around 8-9 am to 11-12
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Base Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---