PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed May 27, 2020 7:53 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: location api
PostPosted: Mon Oct 13, 2014 8:05 am 
Offline
Forum Regular
User avatar

Joined: Fri Sep 05, 2008 3:34 pm
Posts: 539
Location: Victoria, BC
I was looking at ads on my site, I can do better, why limit my ads to USA residents, when tom dick and harry like in canada and the OK

now i already use Google on my site, I know how to take good advantage of their services

I noticed with them they have some location capacility

X-AppEngine-Country:US
X-AppEngine-Region:ca
X-AppEngine-City:norwalk
X-AppEngine-CityLatLong:33.902237,-118.081733

now all I care is country, I am not flogging coffee to a walk by

Syntax: [ Download ] [ Hide ]
<?php
echo ' Client IP address: ';
if ( isset($_SERVER["REMOTE_ADDR"]) )    {
    echo '' . $_SERVER["REMOTE_ADDR"] . ' ';
} else if ( isset($_SERVER["HTTP_X_FORWARDED_FOR"]) )    {
    echo '' . $_SERVER["HTTP_X_FORWARDED_FOR"] . ' ';
} else if ( isset($_SERVER["HTTP_CLIENT_IP"]) )    {
    echo '' . $_SERVER["HTTP_CLIENT_IP"] . ' ';
}
?>
 


then I realized I had yet another idea come to mind, check to see if a given ad is working on the amazon server, sometimes products are removed

Syntax: [ Download ] [ Hide ]
<!-- http://www.amazon.com/dp/YOUR10DIGITASIN returns http-statuscode=200 if it exists, http-statuscode=404 if it does not -->


Top
 Profile  
 
 Post subject: Re: location api
PostPosted: Mon Oct 13, 2014 12:43 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
...Okay?


Top
 Profile  
 
 Post subject: Re: location api
PostPosted: Mon Oct 13, 2014 4:36 pm 
Offline
Forum Regular
User avatar

Joined: Fri Sep 05, 2008 3:34 pm
Posts: 539
Location: Victoria, BC
I was wondering, I guess checking to see if a given AISN is still valid would make sense

Syntax: [ Download ] [ Hide ]
function showAISN(AISN) {
        temp = '<iframe src="http://rcm-na.amazon-adsystem.com/e/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=cpa07-20&o=1&p=8&l=as4&m=amazon&f=ifr&ref=ss_til&asins=';
        temp += AISN;
        temp += '" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>';
        document.write(temp+='\n');
}
 


could I check the AISN with something like an AJAX kind of check or something?

Syntax: [ Download ] [ Hide ]
function showAISN(AISN) {
     if(checkvalid(AISN) {
        temp = '<iframe src="http://rcm-na.amazon-adsystem.com/e/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=cpa07-20&o=1&p=8&l=as4&m=amazon&f=ifr&ref=ss_til&asins=';
        temp += AISN;
        temp += '" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>';
        document.write(temp+='\n');
}
}
 


Top
 Profile  
 
 Post subject: Re: location api
PostPosted: Mon Oct 13, 2014 5:11 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
To do what? What's the question?


Top
 Profile  
 
 Post subject: Re: location api
PostPosted: Mon Oct 13, 2014 8:13 pm 
Offline
Forum Regular
User avatar

Joined: Fri Sep 05, 2008 3:34 pm
Posts: 539
Location: Victoria, BC
how to create checkvalid() so that it can skip over a missing product
not sure show how to leverage AJAX

if(stattus (http://www.amazon.com/dp/YOUR10DIGITASIN ) = 200)

is the idea, not sure if JA or PHP should even be used


Top
 Profile  
 
 Post subject: Re: location api
PostPosted: Mon Oct 13, 2014 8:17 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
Well you can't AJAX to another domain so there's that, but you can AJAX to your own domain which hosts a script that cURLs the appropriate remote URL.

However you really need to use their API instead of making requests to the website proper. I'm not sure exactly what API we use but the endpoint is http://ecs.amazonaws.com/onca/xml.


Top
 Profile  
 
 Post subject: Re: location api
PostPosted: Wed Oct 15, 2014 2:05 pm 
Offline
Forum Regular
User avatar

Joined: Fri Sep 05, 2008 3:34 pm
Posts: 539
Location: Victoria, BC
At the moment I am using local scripts to manage everything, so I was wonder what I can do to check my ad tables with
this is where I ran across the amazon tool
so I was hoping to leverage that


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group