$token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$album_id = "240785731";
$photosgetUploadServer = by("photos.getUploadServer", "v=5.26&group_id=109792228&album_id=".$album_id."&access_token=".$token);
$upload_url = $photosgetUploadServer["response"]["upload_url"];
$path = dirname(__FILE__);
$array = array("file1" => "@".$path."/test1.jpg" );
$upload = curl($upload_url, $array);
$json = json_decode($upload, 1);
var_dump($json);
$test = by("photos.save", "album_id=".$album_id."&hash=".$json["hash"]."&server=".$json["server"]."&photos_list=".$json["photos_list"]."&group_id=109792228&access_token=".$token);
sleep(3);
function by($method, $peremeter){
return json_decode(curl("https://api.vk.com/method/".$method."?".$peremeter),1);
}
function curl($url, $post = null){
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417
Firefox/3.0.3');
if($post){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
$response = curl_exec( $ch );
curl_close( $ch );
return $response;
}
Если сделать var_dump($json) то видно, массив фото пуст ["photos_list"]=> string(2) "[]" в чем проблема?
skrinshoter.ru/s/280117/ypFf3Z