<?php
$params=[
'access_token'=>"",
'group_id'=>"82346155",
'v'=>"5.69"
];
$url = "https://api.vk.com/method/photos.getWallUploadServer?" .http_build_query($params);
$res=json_decode(file_get_contents($url),true);
$upload_url = $res['response']['upload_url'];
$data = array('photo' => new CURLFile('maxresdefault.jpg'));
$ch = curl_init();
print_r($data);
curl_setopt_array($ch, [
CURLOPT_POSTFIELDS => $data,
CURLOPT_URL => $upload_url,
CURLOPT_POST => 1,
CURLOPT_RETURNTRANSFER => 1,
]);
$curl_result = json_decode(curl_exec($ch));
print_r($curl_result);
curl_close($ch);
?>
И в ответ от API я всегда получаю:Array
(
[photo] => CURLFile Object
(
[name] => maxresdefault.jpg
[mime] =>
[postname] =>
)
)
stdClass Object
(
[server] => 639631
[photo] => []
[hash] => 5afc43f8882484fb754ef37413847fba
)
Почему [photo] пустое?