kulor (owner)

Revisions

gist: 57535 Download_button fork
public
Public Clone URL: git://gist.github.com/57535.git
yql.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
class Yql extends Controller {
 
function __construct()
{
parent::Controller();
$this->load->library('yql_lib');
}
 
 
function index()
{
echo '<ul>';
echo '<li><a href="search_twitter/@kulor">Search Twitter for "@kulor"</a></li>';
echo '<li><a href="search_flickr/kulor">Search Flickr for "kulor"</a></li>';
echo '<li><a href="search_yahoo/kulor">Search Yahoo for "kulor"</a></li>';
echo '<li><a href="search_wikipedia/open">Search Wikipedia for "open"</a></li>';
echo '</ul>';
        
}
 
 
function geo_test()
{
echo '<pre>';
print_r($this->yql_lib->test_query());
}
 
 
function search_twitter($term = '@kulor')
{
echo '<pre>';
$yql_query = 'select * from json where url="http://search.twitter.com/search.json?q=' . $term . '" and itemPath = "json.results"';
print_r($this->yql_lib->query($yql_query));
}
 
 
function search_flickr($term = 'kulor')
{
echo '<pre>';
$yql_query = 'select * from flickr.photos.search where text="' . $term . '" limit 10';
print_r($this->yql_lib->query($yql_query));
}
 
 
function search_yahoo($term = 'kulor')
{
echo '<pre>';
$yql_query = 'select title,abstract from search.web where query="' . $term . '"';
print_r($this->yql_lib->query($yql_query));
}
 
 
function search_wikipedia($term = 'open')
{
echo '<pre>';
$yql_query = 'select * from xml where url="http://en.wikipedia.org/w/api.php?action=opensearch&search=' . $term . '&format=xml" and itemPath = "SearchSuggestion.Section.Item"';
print_r($this->yql_lib->query($yql_query));
}
}