Membuat AGC Video Dengan Google API

Membuat AGC Video Dengan Google API,langsung saja tanpa banyak cincong :D
1.daftar dulu di google http://code.google.com/intl/id/apis/loader/signup.html
2.kopi kode berikut kemudian paste di atas kode header

?Download download.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php define('GOOGLE_API_KEY', '');
function pete_curl_get($url, $params){$post_params = array();
foreach ($params as $key => &$val) {
if (is_array($val)) $val = implode(',', $val);
$post_params[] = $key.'='.urlencode($val);
}
$post_string = implode('&', $post_params);
$fullurl = $url."?".$post_string;
$ch = curl_init();curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);curl_setopt($ch, CURLOPT_URL, $fullurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040608'); //kamu bisa pake user agent yang lain, lihat listnya di sini www.user-agents.org
$result = curl_exec($ch);curl_close($ch);
return $result;
}function perform_google_video_search($termstring)
{
$start = 0;
$result = array();
while ($start<1)
{
$searchurl = 'http://ajax.googleapis.com/ajax/services/search/video?v=1.0'; 
$searchurl .= '&key='.'ganti dengan google api'; 
$searchurl .= '&start='.$start;
$searchurl .= '&rsz=small'; //kamu bisa pake "large" untuk menampilkan lebih banyak pencarian
$searchurl .= '&filter=0'; //kamu bisa ganti "filter=1" untuk mem-filter hasil pencarian
$searchurl .= '&q='.urlencode($termstring);
$response = pete_curl_get($searchurl, array());
$responseobject = json_decode($response, true);
if (count($responseobject['responseData']['results'])==0)
break;
$allresponseresults = $responseobject['responseData']['results'];
foreach ($allresponseresults as $responseresult)
{
$result[] = array(
'url' => $responseresult['url'],
'title' => $responseresult['title'],
'thumbnail' => $responseresult['tbUrl'],
'author' => $responseresult['author'],
'content' => $responseresult['content'],
'duration'=> $responseresult['duration'],
'viewcount'=> $responseresult['viewCount'],
'play'=> $responseresult['playUrl'],
);
}
$start += 8;
}
return $result;
}if (isset($_REQUEST['s'])) {
$termstring = urldecode($_REQUEST['s']);
} else {
$termstring = '';}
 
 
?>

3kopi kode berikut ini kemudian paste di di bawah endwile atau else suka suka ente

10 thoughts on “Membuat AGC Video Dengan Google API

  1. matping

    jozz mas makasih atas tutorialnya buat video.reques tutorial boleh mas? kalo boleh gimana cara nya bikin agc gambar tetapi bila gambar di hasil serach di klik tidak lari ke source aslinya?.
    makasih banyak

  2. kuncoro

    masbro help me, helpppp, ane puengen banget bikin kek gini, tapi ada yang error mas

    begini katanya:
    Parse error: syntax error, unexpected ‘}’ in /home/kuncoro/public_html/website-saya.com/wp-content/themes/fastwallpaper/single.php on line 64

    yang ternyata line 64 itu adalah kode ini
    viewcount : ‘.$result['viewCount'].’;

    Help me masbro!!
    makasih so much..

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>