Answer the question
In order to leave comments, you need to log in
Why is the photo array empty VK API CURL PHP?
copy($photo_url, $_SERVER['DOCUMENT_ROOT'].'/tmp/img.jpg'); //Save the photo using the link to the server
$upload_url = json_decode(file_get_contents(" https://api.vk.com/method/photos.getMessagesUpload... ".$token))->response->upload_url; //Get the upload address
$post_params = array(
'photo' => $_SERVER['DOCUMENT_ROOT'].'/tmp/img.jpg'
);
$ch = curl_init($upload_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$response = curl_exec($ch);
curl_close($ch);
In response I get an empty array photo[] :(
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question