forked from jdelamater99/Twitter-RSS-Parser
-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.php
37 lines (27 loc) · 1.13 KB
/
search.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
<?php
//v1.1
$host = 'api.twitter.com';
$method = 'GET';
$path = '/1.1/search/tweets.json'; // api call path
$q = str_replace("+", "%20", urlencode($q));
$query = array( // query parameters
'q' => $q,
'include_entities' => $search_include_entities,
'result_type' => $search_result_type
);
include "functions.php";
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
|| $_SERVER['SERVER_PORT'] == 443) {
$protocol = 'https://';
} else {
$protocol = 'http://';
}
print('<?xml version="1.0" encoding="utf-8"?>'. PHP_EOL);
print('<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en" xml:base="'.$_SERVER['SERVER_NAME'].'">'. PHP_EOL);
print('<id>tag:twitter.com,2006:/search/'.$q.'</id>'. PHP_EOL);
print('<title>Search: '. urldecode($q) . '</title>'. PHP_EOL);
print('<updated>'.date('c', strtotime($twitter_data['statuses'][0]['created_at'])).'</updated>'. PHP_EOL);
print('<link href="https://twitter.com/search?q='.$q.'"/>'. PHP_EOL);
print('<link href="'.$protocol.$_SERVER['SERVER_NAME'].str_replace("&", "&", $_SERVER['REQUEST_URI']).'" rel="self" type="application/atom+xml" />'. PHP_EOL);
include "feed.php";
?>