server json_decode vk photos getMessagesUploadSer ver true url server

 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
$server = json_decode(vk("photos.getMessagesUploadServer", ""), true);
$url = $server["response"]["upload_url"];
echo $url;
if($curl = curl_init()){
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, array(
"photo" => "@".$tmpfname
));
$out = curl_exec($curl);
print_r(json_decode($out, true));
curl_close($curl);
}
$qqqq = json_decode($out, true);
$up = json_decode(vk("photos.saveMessagesPhoto", array(
"server" => $qqqq["server"],
"photo" => $qqqq["photo"],
"hash" => $qqqq["hash"]
)), true);
print_r($up);
$time_screen = time() - $screen_start;
$size = getimagesize($tmpfname);
send($chat_id, "Скриншот страницы ".$args[1]."\nЭто заняло у меня ".get_time($time_screen)."\n\nРазрешение:".$size[0]."x".$size[1]."\nРазмер скриншота: ".HumanBytes(filesize($tmpfname)), $up["response"][0]["id"]);