Fitur TweetLonger WriteLonger untuk Dabr (Twitter Client)


Pertama, cari fungsi twitter_update() di file /common/twitter.php
kemudian cari baian: if ($status) {
dan sebelem: $request = API_URL.’statuses/update.json’;
tambahkan code di bawah ini

if (mb_strlen($status, ‘utf-8’) > 140) {
$header = array(
‘X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json’,
‘X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/"’
);
require_once(‘OAuth.php’);
$consumer = new OAuthConsumer(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);
$sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
list($oauth_token, $oauth_token_secret) = explode(‘|’, $GLOBALS[‘user’][‘password’]);
$token = new OAuthConsumer($oauth_token, $oauth_token_secret);
$signingURL = ‘https://api.twitter.com/1/account/verify_credentials.json’;
$request = OAuthRequest::from_consumer_and_token($consumer, $token, ‘GET’, $signingURL, array());
$request->sign_request($sha1_method, $consumer, $token);

$header[1] .= ", oauth_consumer_key=\"" . $request->get_parameter(‘oauth_consumer_key’) ."\"";
$header[1] .= ", oauth_signature_method=\"" . $request->get_parameter(‘oauth_signature_method’) ."\"";
$header[1] .= ", oauth_token=\"" . $request->get_parameter(‘oauth_token’) ."\"";
$header[1] .= ", oauth_timestamp=\"" . $request->get_parameter(‘oauth_timestamp’) ."\"";
$header[1] .= ", oauth_nonce=\"" . $request->get_parameter(‘oauth_nonce’) ."\"";
$header[1] .= ", oauth_version=\"" . $request->get_parameter(‘oauth_version’) ."\"";
$header[1] .= ", oauth_signature=\"" . urlencode($request->get_parameter(‘oauth_signature’)) ."\"";

$longtweetlink = ‘http://api.writelonger.com/create.php’;
$contents = array(‘text’=>urlencode($status),
‘api_key’=>’WL_H52m239dvsd’,
‘format’=>’json’);
foreach($contents as $key=>$value) {
$fields .= $key . ‘=’ . $value . ‘&’;
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $longtweetlink);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$respond = curl_exec($ch);
$response_info = curl_getinfo($ch);
curl_close($ch);
$result = json_decode($respond);
$status = $result->text;
}

Jangan lupa kunjungi & gunakan Twitter Client dari kami di alamat www.imorv.com🙂

@fays_ozunugt; 140) {
$header = array(
‘X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json’,
‘X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/"’
);
require_once(‘OAuth.php’);
$consumer = new OAuthConsumer(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);
$sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
list($oauth_token, $oauth_token_secret) = explode(‘|’, $GLOBALS[‘user’][‘password’]);
$token = new OAuthConsumer($oauth_token, $oauth_token_secret);
$signingURL = ‘https://api.twitter.com/1/account/verify_credentials.json’;
$request = OAuthRequest::from_consumer_and_token($consumer, $token, ‘GET’, $signingURL, array());
$request->sign_request($sha1_method, $consumer, $token);

$header[1] .= ", oauth_consumer_key=\"" . $request->get_parameter(‘oauth_consumer_key’) ."\"";
$header[1] .= ", oauth_signature_method=\"" . $request->get_parameter(‘oauth_signature_method’) ."\"";
$header[1] .= ", oauth_token=\"" . $request->get_parameter(‘oauth_token’) ."\"";
$header[1] .= ", oauth_timestamp=\"" . $request->get_parameter(‘oauth_timestamp’) ."\"";
$header[1] .= ", oauth_nonce=\"" . $request->get_parameter(‘oauth_nonce’) ."\"";
$header[1] .= ", oauth_version=\"" . $request->get_parameter(‘oauth_version’) ."\"";
$header[1] .= ", oauth_signature=\"" . urlencode($request->get_parameter(‘oauth_signature’)) ."\"";

$longtweetlink = ‘http://api.writelonger.com/create.php’;
$contents = array(‘text’=>urlencode($status),
‘api_key’=>’WL_H52m239dvsd’,
‘format’=>’json’);
foreach($contents as $key=>$value) {
$fields .= $key . ‘=’ . $value . ‘&’;
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $longtweetlink);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$respond = curl_exec($ch);
$response_info = curl_getinfo($ch);
curl_close($ch);
$result = json_decode($respond);
$status = $result->text;
}

Jangan lupa kunjungi & gunakan Twitter Client dari kami di alamat www.imorv.com🙂

@fays_ozunu

5 Tanggapan

  1. wah, mantap gan. berhasil di TC ane😀

  2. Internal Server error, itu biasanya karena hosting nya gk sanggup gan, atau salah settihng di .htaccess nya.
    Kalau gk mau repot klik aja http://myprivate.tk gan, bisa langsung bikin twitter client sendiri tapi gk perlu ribet mikirin hosting, di layanin langsung sama myprivate.tk

  3. gan itu kok script kurang”? ane bagi yang lengkap beserta tutornya.. mentions ke @boohemiann butuh untuk longtweet, edit profil, connect fb.. makasih gan ane kasih jempol :jempol2

  4. kunjungi punya ane, di http://www.zbuddy.16mb.com pasti pas mau masuk keluar error 500😦.totlong kasi solusi yaa

  5. gan ane dah buat twitter klien dari dabr,terus pas mau nyoba eh keluar error 500.bisa bantu ane gak?

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: