-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfsock.php
40 lines (40 loc) · 1.12 KB
/
fsock.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
<?php
// if ($_SERVER[ 'POST' == 'REQUEST_METHOD']) {
// code...
// ini_set('display_errors','stderr');
// $remoteDir = 'https://graph.qq.com/t/add_t';
$result;
$port = 80 | 443;
$host = 'graph.qq.com/t/add_t';
$method = 'POST' | 'GET';
$contenttype = 'text/html' | 'text/plain' | 'text/xml';
$params=array(
'access_token' => $_POST['access_token'],
'oauth_consumer_key' => $_POST['oauth_consumer_key'],
'openid' => $_POST['openid'],
'format' => $_POST['format'],
'content' => $_POST['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;
return;
//}
?>