When sending multipart / form-data to the received url, request
https://pu.vk.com/c639830/upload.php?act=do_add&mid=xxx&aid=-14&gid=0&hash=xxxx&rhash=xxxxx&swfupload=1&api=1&wallphoto=1 from the VK server comes a semi-correct answer (there is a server, and hash, no photo). Here's how it comes:
{"server":87899,"photo":"[]","hash":"xxxx"} Here is how it is expected:
{ "server":123456, "photos_list":"[{\"photo\":\"e9f2eba71b:y\",\"sizes\":[[\"s\",\"123456852\",\"e65f\",\"Br4ir9YAvO8\",75,41],[\"m\",\"123456852\",\"e660\",\"Lqpe1N8s8zY\",130,71],[\"x\",\"123456852\",\"e661\",\"tRFbnaIP_4c\",604,330],[\"y\",\"123456852\",\"e662\",\"8JhBOy0qR6o\",748,409],[\"o\",\"123456852\",\"e663\",\"fn5KcewNluM\",130,87],[\"p\",\"123456852\",\"e664\",\"ESWOdpl7bvY\",200,133],\"kid\":\"569c3da3b168b347315aa5adc92a953a\",\"debug\":\"xsymyxyyyoypyqyry\"}]", "aid":98754321, "hash":"22b333dbbef7cd9b1f9829b5f8713f86" } Test code
function get_web_page($url, $post = null) { $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); if($post){ curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; return $header; } $for_upload = get_web_page("https://api.vk.com/method/photos.getWallUploadServer?access_token=".$token."&group_id".$id); $url_upload = json_decode($for_upload['content'])->response->upload_url; $upload = get_web_page($url_upload, array("file1" => "test.jpg")); What could be the problem?