$v = '5.73'; //версия vk api
$image_path = "http://worldwideshop.ru/vbot-dev/api/test.jpg"; //путь до картинки
$fp = fopen($image_path, 'r');
// получаем урл для загрузки
$url = file_get_contents("https://api.vk.com/method/photos.getMessagesUploadServer?album_id=".$album_id."&group_id=".$group_id."&v=".$v."&access_token=".$token);
$url = json_decode($url)->response->upload_url;
var_dump($url);
echo "<br>";
// отправка post картинки
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_INFILE, $fp);
$result = json_decode(curl_exec($ch),true);
echo$result['server'];
echo "<br>";
echo$result['hash'];
echo "<br><br><br>";
// сохраняем
$safe = file_get_contents("https://api.vk.com/method/photos.saveMessagesPhoto?server=".$result['server']."&photos_list=".$result['photos_list']."&album_id=".$result['aid']."&hash=".$result['hash']."&gid=".$group_id."&access_token=".$token."&v=".$v);
$safe = json_decode($safe,true);
print_r($safe);
string(189) "https://pu.vk.com/c841126/upload.php?act=do_add&mid=13897175&aid=-64&gid=162294758&hash=d09aa905f07ca35ecfbb2c2742d741d1&rhash=156f9039ec0316e8f30f9176ed9c3a5f&swfupload=1&api=1&mailphoto=1"
841126
b0b9c125e33bb38772dae21c3c32c03e
Array ( [error] => Array ( [error_code] => 100 [error_msg] => One of the parameters specified was missing or invalid: photo is undefined [request_params] => Array ( [0] => Array ( [key] => oauth [value] => 1 ) [1] => Array ( [key] => method [value] => photos.saveMessagesPhoto ) [2] => Array ( [key] => server [value] => 841126 ) [3] => Array ( [key] => photos_list [value] => ) [4] => Array ( [key] => album_id [value] => ) [5] => Array ( [key] => hash [value] => b0b9c125e33bb38772dae21c3c32c03e ) [6] => Array ( [key] => gid [value] => 162294758 ) [7] => Array ( [key] => v [value] => 5.73 ) ) ) )