Jumat, 11 April 2014

Auto Tweet Twitter April 2014

Download dulu bahannya disini:
https://www.dropbox.com/s/2bfyghoj6gokdoj/wiceng404.rar

Lalu, upload semua isi RAR ke dalam hosting (kalau bisa jangan IDHost, ane saaranin pake 000webhost.com atau 2freehosting.com)

Sudah di upload gan? Edit tweet.php dan tmhOauth.php nya.

Cara membuat Apps Twitter:

1. Buka dev.twitter.com
2. Klik "Sign In" di pojok kanan atas
3. Login
4. Klik foto kita di pojok kanan atas
5. Pilih "Create a new Applications"
6. Isi sesuai dengan yang seharusnya :v
7. Kalau sudah, Klik setting di App nya
8. Ubah Access Levelnya jadi Read and Write dan checklist "Allow this application to be used to Sign in with Twitter"
9. Klik detail lagi
10. Create Access Token deh

consumer_key, consumer_secret, user_token, user_secret bisa di dapatkan di dev.twitter.com. Sebelum memasukan, pastikan Apps Twitter yang sudah dibuat tadi Acces Levelnya Read and Write seperti ini:

http://s23.postimg.org/ago2ikbyz/Screen_Shot_2013_12_22_at_17_59_03.png

Jika sudah di edit, coba test dengan menuju web nya. Kalo work contohnya seperti ini: http://bottwit404.esy.es/tweet.php

Tinggal cron nya deh :D


Cara setting cron:

1. Pergi ke drive.google.com
2. Klik "Buat" lalu klik "Spreadsheet"
3. Setelah membuat spreadsheet, edit nama spreadsheet menjadi CronLog.
Copy URL yang ada di address bar spreadsheet, karena kita membutuhkan key nya.
Lihat URL, spreadsheet. Contoh: https://docs.google.com/spreadsheet/ccc?key=0Atr3j1nvzsd2ZuUJqU1JtbVVlFqdGRXYUxKSMUdLE#gid=0
Berarti Key nya: 0Atr3j1nvzsd2ZuUJqU1JtbVVlFqdGRXYUxKSMUdLE
4. Lalu, klik Alat lalu pilih Pengelola Scrip
5. Copy Source Code berikut lalu paste-kan

function cronExecute() {

var url = "http://www.WEBSITEANDA.com/URL";

var options = {
"method" : "get",
"headers" : {'User-Agent' : 'Mozilla Firefox 14.0',
             'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
            },
"payload" : "",
"contentType" : "application/xml; charset=utf-8"
};

var request_starttime = new Date();
// fetch the HTTP / HTTPS request and get the response
var response = UrlFetchApp.fetch(url,options);
var request_endtime = new Date();

// use any spreadsheet, use its key
// var ss = SpreadsheetApp.openById("KEY-SHEET");
// use this script's default spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
// get the worksheet
var sheet = ss.getSheets()[0];

// inserting values into the sheet
sheet.insertRowBefore(1);
var colValues = [[ request_starttime, request_endtime,
                 response.getResponseCode(), response.getHeaders().toSource(),
                 url, response.getContentText() ]];
sheet.getRange(1, 1, 1, 6).setValues(colValues);

// if something is not working, use the Logger object/function (uncomment it and modify it)
// Logger.log(ss.getSpreadsheetTimeZone());

// view the log details from VIEW -> LOGS

// You can also RUN the script and view its Execution log
// try this VIEW -> EXECUTION TRANSCRIPTS

// Make sure you MODIFY and then RUN the script and
// verify its working OK by looking at the spreadsheet contents
// try this RUN -> CRONEXECUTE
// check the spreadsheet contents

// After its working OK, you should setup a TRIGGER to execute it as and when you want (frequency)
// try this TRIGGERS -> ALL YOUR TRIGGERS

}


6. Ganti WEBSITE ANDA dengan web auto tweet anda, contoh: http://bottwit404.esy.es/tweet.php

7. Ganti KEY-SHEET dengan key Spreadsheet anda

8. Klik Sumber Daya, lalu klik Pemicu Scrip Saat Ini

9. Lalu klik No triggers set up. Click here to add one now

10. Setelah itu, ganti From Spreadsheet di bagian Events menjadi Time-driven.

11. Tentukan waktunya, Save deh :D

0 komentar:

Posting Komentar

Total Tayangan Halaman

Diberdayakan oleh Blogger.

Created by Stmn-6Kr