forked from josephj/sync-with-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.php
More file actions
48 lines (45 loc) · 1.14 KB
/
proxy.php
File metadata and controls
48 lines (45 loc) · 1.14 KB
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
<?php
$api_key = "cbq1I79DDL8Eec1ctSheVP3psj6YSaPP";
function do_act( $target_url , $type , $data , $cookie_file = NULL)
{
$ch = curl_init();
if ($type == 'GET')
{
$target_url .= http_build_query( $data );
curl_setopt($ch, CURLOPT_URL, $target_url );
}
else
{
curl_setopt($ch, CURLOPT_URL , $target_url);
curl_setopt($ch, CURLOPT_POST , true);
curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
}
if (isset($cookie_file))
{
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec( $ch );
curl_close( $ch );
return $result;
}
$response = (do_act(
"http://www.plurk.com/API/Realtime/getUserChannel",
"POST",
array(
"api_key" => "$api_key",
),
"/tmp/plurk_cookie"
));
$response = json_decode($response);
$url = $response->comet_server;
$response = (do_act(
"$url",
"POST",
array(
"api_key" => "$api_key",
),
"/tmp/plurk_cookie"
));
?>