1
0
Fork 0
oldhaven/php-bak/api_test.php

46 lines
1.2 KiB
PHP
Executable File

<?php
echo '<pre>';
require_once 'common.php';
$q = 'Fighters';
$api_config = array(
'api_id' => '2259817',
'api_key' => 'h0MiRNiffT',
'api_key1' => 'FUrv4Dutqz4Lnzdh6UTe',
'user_id' => '5728795',
);
$post_v = array(
'api_id' => $api_config['api_id'],
'method' => 'audio.search&q='.$q,
'sig' => md5($api_config['user_id'].'api_id='.$api_config['api_id'].'method=audio.searchq='.$q.'v=3.0format=JSONtest_mode=1'.$api_config['api_key']),
'v' => '3.0',
'format' => 'JSON',
'test_mode' => 1,
'sid' => '47c2f5501b22a3e3aa6947e5e74d1a72381267df2502570eb75c94481ade'
);
$post = '';
foreach($post_v as $key => $val) {
$post .= '&'. $key .'='. $val;
}
$post = substr($post, 1);
$api_url = 'http://api.vk.com/api.php';
$referer = 'http://vk.com/app'. $api_config['api_id'] .'_'. $api_config['user_id'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_USERAGENT, 'test');
$data = curl_exec($ch);
curl_close($ch);
echo $post."\n\n";
echo(htmlentities($data));