(View Original Web?)

HOBBY > SOURCE CODE

[tutorial PHP] cara membuat script auto post google plus rest API OAUTH


(Page 1 of 1)
 

GPLUS? salah satu social media yang ga kalah pamor dengan facebook maupun twitter. saat ini kita baru tau kalau google developer menyediakan API untuk mining datanya dengan format json. TAPI hanya sebatas read only, so sangat disayangkan, sambil menunggu developer resmi google mengembangkan lebih jauh apa salahnya kalau kita mencoba membuatnya sendiri tentunya basicly PHP programming dibutuhkan untuk kasus ini. kita akan memaksa melakukan stream post dengan beberapa trik khusus.
 

sebelumnya kita telah membuat
1. Auto post group/page/wall facebook
2. Auto post twitter

ok, sementara ane main dibelakang panggung sambil ngerjain script ini, mohon rekan-rekan bantu mengolahnya juga, pasti hasilnya akan lebih cepat.

ane kasih bantu trik nya yah:
menurut ane metode nya hampir sama dengan script sebelumnya yang telah ane buat. ambil cookies dan simpan dan lakukan post method ke page google plus anda dengan cookies yang tersimpan tadi

UPDATE
AKHIRNYA DAPET JUGA CELAHNYA

Code:
<?php 
/********************************
Script powered by www.ms-room.com
update check here https://www.ms-room.com/index.php/topic,5765.0.html
********************************/

$cURL = new cURL("cookiesgplus");
$cURL->user_agent "Opera/9.80 (J2ME/MIDP; Opera Mini/9.80 (S60; SymbOS; Opera Mobi/23.348; U; en) Presto/2.5.25 Version/10.54";
$cURL->timeout 0;

$firstread $cURL->open("https://accounts.google.com/Login?btmpl=mobile_tier2&hl=en");
$firstread preg_replace('/\\n/','',$firstread);
$firstread preg_replace('!\s+!',' ',$firstread);

preg_match_all('/name="dsh" id="dsh" value="(.*?)"/',$firstread$dsh);
preg_match_all('/name="GALX" value="(.*?)"/',$firstread$GALX);

$form = array();
/********************************/
$form["Email"] = "";
$form["Passwd"] = "";
$idpagegplus '';
/********************************/
$form["dsh"] = $dsh[1][0];
$form["timeStmp"] = "";
$form["btmpl"] = "mobile_tier2";
$form["GALX"] = $GALX[1][0];
$form["hl"] = "en";
$form["secTok"] = "";
//$form["rmShown"] = "1";
$form["signIn"] = "Sign in";

$read $cURL->open("https://accounts.google.com/ServiceLoginAuth",$form);
cektoken();

function 
cektoken()
{
global 
$cURL;

//echo $cURL->open('https://plus.google.com/app/plus/?force=1');
//echo $cURL->open('https://plus.google.com/app/plus/x');

$hasillinktokenexplorer $cURL->open('https://plus.google.com/app/plus/x');
preg_match_all('/<A HREF="(.*?)"/',$hasillinktokenexplorer,$myprofile);
$hasillinktokenexplorer $cURL->open($myprofile[1][0].'?v=compose&fid='.$idpagegplus.'');


preg_match_all('/name="at" value="(.*?)"/'$hasillinktokenexplorer$matches);
$token $matches[1][0];
//$deskripsiposting = preg_replace ('/http:\/\/(.*?) /', '', $isipesan2);

$postgroup = array();
$postgroup["ie"] = "UTF-8";
$postgroup["newcontent"] = 'ISI PESAN YANG MAU DIPOST';

$postgroup["at"] = $token;
$postgroup["post"] = " post ";
$suksespostgroup $cURL->open($myprofile[1][0].'?fid='.$idpagegplus.'&v=compose&a=post&group=b0&hideloc=1',$postgroup);
}

##############################
class cURL
{
    var 
$user_agent "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)";
    var 
$proxy_ip "";
    var 
$proxy_port 0;
    var 
$proxy_url "";
    var 
$proxy_type "";
    var 
$status 0;
    var 
$error "";
    var 
$timeout 30;
    var 
$cookies "";
    var 
$last_url "";
    var 
$fix_cookies false;

    function 
__construct($cookies)
    {
        if (!
$cookies$cookies tempnam("./""CURLCOOKIE");
        
$this->cookies $cookies;
    }

    function 
open($url,$post="") {
        
$ch curl_init();
        if (
$this->proxy_url != ""$url str_replace("%s"str_replace("https://","",$url), $this->proxy_url);
        
curl_setopt($chCURLOPT_URL$url);
        
curl_setopt($chCURLOPT_HEADER0);
        if (
$post != "") {
            
curl_setopt($chCURLOPT_POST,1);
            
curl_setopt($chCURLOPT_POSTFIELDS$post);
        }

        
curl_setopt($chCURLOPT_USERAGENT$this->user_agent);
        
curl_setopt($ch,CURLOPT_TIMEOUT$this->timeout);
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
curl_setopt($ch,CURLOPT_REFERER$this->last_url);
        
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
        
curl_setopt ($chCURLOPT_COOKIEJAR$this->cookies);
        
curl_setopt ($chCURLOPT_COOKIEFILE$this->cookies);

        if (
$this->proxy_ip != "") {
            
curl_setopt($chCURLOPT_PROXYPORT$this->proxy_port);
            
curl_setopt($chCURLOPT_PROXYTYPE'HTTP');
            
curl_setopt($chCURLOPT_PROXY$this->proxy_ip);
            if (
$this->proxy_type == "socks"curl_setopt($chCURLOPT_PROXYTYPECURLPROXY_SOCKS5);
        }
        
$data curl_exec($ch);
            
$this->status curl_getinfo($ch,CURLINFO_HTTP_CODE);
            
$this->error curl_error($ch);
        
$this->last_url $url;
        
curl_close($ch);
        return 
$data;
    }
}
function 
stringBetween($start$end$var)
{
    return 
preg_match('{' preg_quote($start) . '(.*?)' preg_quote($end) . '}s'$var$m)
    ? 
$m[1]
    : 
'';
}
?>
<META NAME="robots" CONTENT="noindex,nofollow">

HOW TO?
anda cukup mengisi bagian ini dengan akun GPLUS anda
Code:
/********************************/
$form["Email"] = "";
$form["Passwd"] = "";
$idpagegplus = '';
/********************************/

dan bagian ini
$postgroup["newcontent"] = ' ISI PESAN YANG MAU DIPOST';

 
regards
admin ms-room.com
update fix
 
(Page 1 of 1)

Navigation

Back Sub-Forum