Answer the question
In order to leave comments, you need to log in
Why is the "photo" array empty?
$url = json_decode(file_get_contents("https://api.vk.com/method/photos.getMessagesUploadServer?access_token=".$this->token), true)["response"]["upload_url"];
$photo = __DIR__."/status1.jpg";
$post = ["photo" => curl_file_create($photo)];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data; charset=UTF-8'));
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
Answer the question
In order to leave comments, you need to log in
Pick in the direction of the file. Maybe there is no access, maybe there is no file. Works for me
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question