-
Notifications
You must be signed in to change notification settings - Fork 0
/
sock.php
41 lines (39 loc) · 1.06 KB
/
sock.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
<?php
$access_token = '100266584';
$oauth_consumer_key = '2e499a2c58e20f1adb74c31d497a96b4';
$openid = 'F76FAE0544CF6A04343C430F24375FE5';
$format = 'json';
$content = 'Mon Apr 30 2012 17:50:20 GMT 0800 (Öйú±ê׼ʱ¼ä)';
$result;
$port = 80 | 443;
$host = 'graph.qq.com/t/add_t';
$method = 'POST';
// $contenttype = 'text/html' | 'text/plain' | 'text/xml';
$params=array(
'access_token' => $access_token,
'oauth_consumer_key' => $oauth_consumer_key,
'openid' => $openid,
'format' => $format,
'content' => $content
);
if ($port == 443) {
$sshhost = 'ssl://'.$host;
} else {
$sshhost = $host;
}
$fp = fsockopen($sshhost,$port);
$content = http_build_query($params);
fwrite($fp, "POST /reposter.php HTTP/1.1\r\n");
fwrite($fp, "Host: $host\r\n");
fwrite($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
fwrite($fp, "Content-Length: ".strlen($content)."\r\n");
fwrite($fp, "Connection: close\r\n");
fwrite($fp, "\r\n");
fwrite($fp, $content);
header('Content-type: text/plain');
while (!feof($fp)) {
$result.= fgets($fp, 1024);
}
fclose($fp);
echo $result;
?>