Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis

Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis - Hallo sahabat Serba Ada, Pada Artikel yang anda baca kali ini dengan judul Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan Artikel Programing, yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.

Judul : Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis
link : Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis

Baca juga


Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis


Kode di bawah menggunakan 'p1' sebagai country code amerika.
Cara lihat country code lain, buka link ini http://www.google.com/trends/hottrends

Pilih negaranya dari dropdown, contoh Brazil, maka URL di browser akan jadi



 Maka kode Brazil = p18

Contoh kode negara lain :
- Colombia = p32
- India = p3

PHP Code:

<?php

$keyword 
my_get_google_hot_trend('p1');
echo 
'<pre>'; print_r($keyword['data']);
echo 
'</pre>';
//////////////
function xrvel_curl($url) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($chCURLOPT_AUTOREFERERtrue);
    
curl_setopt($chCURLOPT_HEADERfalse);
    @
curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    @
curl_setopt($chCURLOPT_MAXREDIRS2);
    
curl_setopt($chCURLOPT_USERAGENT'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6');
    
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
    
curl_setopt($chCURLOPT_COOKIEJARdirname(__FILE__).'/cookie.txt');
    
curl_setopt($chCURLOPT_COOKIEFILEdirname(__FILE__).'/cookie.txt');
    
curl_setopt($chCURLOPT_TIMEOUT30);
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_REFERER$url);
    
$res trim(curl_exec($ch));
    
curl_close($ch);
    unset(
$ch);
    return 
$res;
}

function 
my_get_google_hot_trend($country_code) {
    
$result = array(
        
'data' => array(),
        
'error' => ''
    
);

    
$res xrvel_curl('http://www.google.com/trends/hottrends/widget?pn='.$country_code.'&tn=10&h=413');

    if (
$res == '') {
        
$result['error'] = 'Failed. Empty response.';
        return 
$result;
    }

    if (!
preg_match_all("/\<span class='widget-title-in-list'\>(.*)\<\/span\>\<\/span\>\<span class='widget-list-more-arrow/siU"$res$match)) {
        
$result['error'] = 'Failed to parse.';
        return 
$result;
    }

    
$keywords $match[1];

    
$result['data'] = $keywords;
    return 
$result;
}
?>
 


Demikianlah Artikel Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis

Sekianlah artikel Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.

Anda sekarang membaca artikel Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis dengan alamat link https://fantastissekali.blogspot.com/2014/06/dari-serba-serbi-cara-grab-google-trend.html

0 Response to "Dari Serba Serbi Cara Grab Google Trend di Negara Tertentu. Fantastis"

Post a Comment