Download - YQL: More than just data
![Page 1: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/1.jpg)
YQL: Find more than just data
Philip Tellis / [email protected]
Yahoo!7 Open Session – 11 May 2010 – #y7os
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 2: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/2.jpg)
$ finger philip
Philip [email protected]
@bluesmoonyahoogeekhttp://bluesmoon.info/
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 3: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/3.jpg)
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 4: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/4.jpg)
missingkids.com
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 5: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/5.jpg)
missingkidsmap.com
http://www.missingkidsmap.com/read.php?state=CA
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 6: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/6.jpg)
<locations><maplocation zoom="5"
state_long="-119.838867"state_lat="37.370157"/>
<location id="1"firstname="Anastasia"lastname=" Shearer "picture="img width=160 target=_new src=http://www.missingkids.com/photographs/NCMC1140669c1.jpg"picture2="img width=160 target=_new src=http://www.missingkids.com/photographs/NCMC1140669e1.jpg"medpic = "img width=60 border=0 target=_new src=http://www.missingkids.com/photographs/NCMC1140669c1.jpg"smallpic="img width=30 border=0 target=_new src=http://www.missingkids.com/photographs/NCMC1140669c1.jpg"policenum="1-661-861-3110"policeadd="Kern County Sheriffs Office (California)"policenum2=""policeadd2=""st=" CA"city="BAKERSFIELD"missing="12/26/2009"status="Endangered Runaway"age="16"url="1140669"lat="35.3733333333333"lng="-119.017777777778"/>
...</locations>
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 7: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/7.jpg)
Death by 404
API call on every 404 page =⇒
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 8: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/8.jpg)
This looks like a job for...
YQLCAT
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 9: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/9.jpg)
SELECT
SELECT * From xml Whereurl=’http://www.missingkidsmap.com/read.php?state=ZZ’
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 10: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/10.jpg)
Geo
More useful if we find local kids
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 11: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/11.jpg)
YQL can do it
SELECT * From ip.location Where ip=@ip
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 12: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/12.jpg)
{"query":{..."results":{"Response":{"Ip":"209.117.47.253","Status":"OK","CountryCode":"US","CountryName":"United States","RegionCode":null,"RegionName":null,"City":null,"ZipPostalCode":null,"Latitude":"38","Longitude":"-97","Timezone":"-6","Gmtoffset":"-6","Dstoffset":"-5"}
}}
}
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 13: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/13.jpg)
WoEID
SELECT place.woeid From flickr.placesWhere lat=@lat And lon=@lon
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 14: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/14.jpg)
WoEID
SELECT place.woeid From flickr.placesWhere (lat, lon) IN(SELECT Latitude, Longitude From ip.locationWhere ip=@ip)
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 15: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/15.jpg)
{"query":{"count":"1",..."results":{"places":{"place":{"woeid":"12588378"
}}
}}
}
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 16: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/16.jpg)
Country/State
SELECT country.code, admin1.codeFrom geo.placesWhere woeid=@woeid
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 17: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/17.jpg)
All together
SELECT country.code, admin1.code From geo.placesWhere woeid IN(
SELECT place.woeid From flickr.placesWhere (lat, lon) IN(
SELECT Latitude, LongitudeFrom ip.location
Where ip=@ip)
)
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 18: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/18.jpg)
{"query":{"count":"1",..."results":{"place":{"country":{"code":"US"
},"admin1":{"code":"US-KS"
}}
}}
}
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 19: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/19.jpg)
And that’s it
Throw in a bit of PHP to turn the JSON into HTMLCSS to style itWrap it in your page templateeg: http://bluesmoon.info/foobar
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 20: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/20.jpg)
PHP
$json = http_get($missing_kids_url);$o = json_decode($json, 1);$children = $o[’query’][’results’]
[’locations’][’location’];
$child = array_rand($children);
print_404($child);
...
header(’HTTP/1.0 404 Not Found’);
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 21: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/21.jpg)
ErrorDocument 404 /404.php
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 22: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/22.jpg)
Links
http://tech.bluesmoon.info/2010/02/convert-ip-to-geo-info-using-yql.htmlhttp://tech.bluesmoon.info/2010/02/missing-kids-on-your-404-page.htmlhttp://developer.yahoo.com/yql/http://www.missingkidsmap.com/
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 23: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/23.jpg)
Photo credits
http://lolcats.com/view/11439/http://lolcats.com/view/13347/http://www.flickr.com/photos/wwworks/440672445/
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data
![Page 24: YQL: More than just data](https://reader037.vdocuments.mx/reader037/viewer/2022110301/540ee63c8d7f72767e8b50c4/html5/thumbnails/24.jpg)
Thank you
Philip [email protected]
@bluesmoonhttp://bluesmoon.info/slideshare.net/bluesmoon
Yahoo!7 Open Session – 11 May 2010 – #y7os YQL: Find more than just data