Access error
 Регистрация или ->Экспорт данныхПоиск
Войти
Экспорт:
Папки

/var_null/saytostroenie/socialnie-seti/vk/API/posting-na-stenu
Не экспортировать закрытые директории
Преобразовывать заметки в html
Экспортировать
Открыть директорию для всех Удалить директорию
Применить
 Стили директорииДобавить заметку
Постинг на стену с картинкой и ссылкой
2014-12-28 08:43:19 Удалить Фон Изображение Импорт из текстового файла Редактировать Копировать в буфер
header('Content-Type: text/html; utf-8; charset=UTF-8');


$access_token = "9a052975ca396a6ba86742a21ed6906cc130ff7aa66b991d03d2c2d953a2cfda5d9565d22712feee791037";

		$link = "http://www.fondovik.com/";		
		$urlImage = 'http://cs540103.vk.me/c624821/v624821443/13a35/tVLSSnIeks0.jpg';		
		$msg = "test";
		
		$args = array();
		$args['gid'] = "35410051"; //fondovik
		$args['access_token'] = $access_token;
		
		$mas_response = photos_getWallUploadServer($args);
		
		echo "
";

		print_r($mas_response);

		echo "
"; $upload_url = $mas_response['response']['upload_url']; if($upload_url != "") { $file_name = "tmp.jpg"; file_put_contents($file_name, file_get_contents($urlImage)); $mas_response = UploadServer($upload_url, $file_name); } echo "
";

		print_r($mas_response);

		echo "
"; $args = array(); $args['gid'] = "35410051"; //fondovik $args['access_token'] = $access_token; $args['photo'] = $mas_response['photo']; $args['server'] = $mas_response['server']; $args['hash'] = $mas_response['hash']; $mas_response = photos_saveWallPhoto($args); echo "
";

		print_r($mas_response);

		echo "
"; $photo_id = $mas_response['response'][0]['id']; $args = array(); $args['owner_id'] = "-35410051"; //fondovik $args['access_token'] = $access_token; $args['from_group'] = 1; $args['signed'] = 0; $args['message'] = $msg; $args['attachments'] = $photo_id . ',' . $link; $mas_response = wall_post($args); echo "
";

		print_r($mas_response);

		echo "
"; function photos_saveWallPhoto($args) { $return_mas = array(); $postvars = "group_id=" . $args['group_id'] . getArgsStr($args, "group_id"); //echo "postvars=" . $postvars . "
"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.vk.com/method/photos.saveWallPhoto"); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); $con = curl_exec($ch); curl_close($ch); $return_mas = json_decode($con, true); return $return_mas; } function UploadServer($upload_url, $file_name) { $return_mas = array(); $post_params = array( "file1" => "@".dirname(__FILE__)."/" . $file_name ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $upload_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params); $con = curl_exec($ch); curl_close($ch); $return_mas = json_decode($con, true); return $return_mas; } function photos_getWallUploadServer($args) { $return_mas = array(); $postvars = "gid=" . $args['gid'] . getArgsStr($args, "gid");//35410051 //echo "postvars=" . $postvars . "
"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.vk.com/method/photos.getWallUploadServer"); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); $con = curl_exec($ch); curl_close($ch); $return_mas = json_decode($con, true); return $return_mas; } function wall_post($args) { $return_mas = array(); $postvars = "owner_id=" . $args['owner_id'] . getArgsStr($args, "owner_id");//-35410051 //echo "postvars=" . $postvars . "
"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.vk.com/method/wall.post"); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); $con = curl_exec($ch); curl_close($ch); $return_mas = json_decode($con, true); return $return_mas; } function getArgsStr($args, $exc) { $args_str = ""; $keys_args = array_keys($args); for($k = 0; $k < count($keys_args); $k++) { if($keys_args[$k] != $exc) $args_str .= "&" . $keys_args[$k] . "=" . $args[$keys_args[$k]]; } return $args_str; }
Участвуй в наполнении сайта, создай свое дерево знаний. Регистрация

@include_encode 2015