{% else-1 %}

                        
function vk($method, $data, $token=""){

$url="https://api.vk.com/method/".$method;

if( $curl = curl_init() ){

curl_setopt($curl,CURLOPT_URL,$url);

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);

$data['access_token']=$token;

curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);

curl_setopt($curl, CURLOPT_POST, 1);

curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

$out = curl_exec($curl);

return $out;

curl_close($curl);

}

}

// пример вызова:

$res = vk("wall.post", array(

"owner_id" => 0,

"friends_only" => 0,

"message" => "hello from php =)",

));
0 18 0
Без комментариев...