CSS

Friday, January 18, 2013

Facebook - Bot Upload Random Image

tiada hari tanpa bot
kan pernah tuh share auto update status
nah sekarang ada yang baru lagi auto upload poto atau image
cara mainya tetep sama yang namanya bot harus make hasting php
hostingnya daftar di sini ajah gan yang gratis
langsung saja nih sscripnya
berikut codenya untuk link url-imagenya tanpa shorten url :



Code:

<?php

$access_token = "YOUR_TOKEN"; //input your token
$graph_upload = "https://graph.facebook.com/me/photos?method=POST";//Replace "me" AS TARGET ID #friend_id, album_id,group_id,page_id

//random image
srand((double)microtime()*1000000);
$arry_txt = file("all_images_url.txt");// replace your *.txt file
$your_url=$arry_txt[rand(0, sizeof($arry_txt) -1)


//uplod image to facebook
$ch = curl_init();
$attachment = array( 'access_token' => $access_token,
'url' => $your_url,
'message' => "your status here",
);

curl_setopt($ch, CURLOPT_URL,$graph_upload);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
$result= curl_exec($ch);

curl_close ($ch);
?>

Yang masih bisa pake token blackberry untuk upload silahkan pake ini, berikut codenya untuk link url-imagenya menggunakan API KEY bit.ly shorten url :

. Untuk mendapatkan API KEY bit.ly anda harus sudah daftar di https://bitly.com/. yang sudah punya akun bit.ly langsung ambil API KEY disini http://bitly.com/a/your_api_key

Code:

<?php

$access_token = "YOUR_TOKEN"; //input your token
$graph_upload = "https://graph.facebook.com/me/photos?method=POST";//Replace "me" AS TARGET ID #friend_id, album_id,group_id,page_id

//random image
srand((double)microtime()*1000000);
$arry_txt = file("all_images_url.txt");// replace your *.txt file
$your_url=$arry_txt[rand(0, sizeof($arry_txt) -1)


//short url using bitly API
$api_key = "YOUR_BITLY_API_KEY"; //put your API key here

$api_username = "bitly_username"; //Replace this with your bit.ly username

$query = "login=$api_username&apiKey=$api_key";

$bitly_url = "http://api.bit.ly/v3/shorten?$query&longurl=[url]&format=json";

$bitly_url = str_replace('[url]', $your_url, $bitly_url);

$short_json = file_get_contents($bitly_url);

$short_array = json_decode($short_json);

$short_link = $short_array->data->url;


//uplod image to facebook
$ch = curl_init();
$attachment = array( 'access_token' => $access_token,
'url' => $short_link,

'message' => "your status here",
);

curl_setopt($ch, CURLOPT_URL,$graph_upload);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
$result= curl_exec($ch);

curl_close ($ch);
?>

all_images_url.txt adalah kumpulan link gambar yang akan diupload secara acak
contoh

Code:

http://distilleryimage2.s3.amazonaws.com/fab35d54460711e2930d22000a9f12ad_7.jpg
http://distilleryimage7.s3.amazonaws.com/da1f3d6245dd11e2ad8422000a1fa8e9_7.jpg
http://distilleryimage4.s3.amazonaws.com/42501e4c45ca11e28e2022000a1cdd10_7.jpg
http://distilleryimage2.s3.amazonaws.com/ac15befe437c11e2ad9722000a9e2977_7.jpg
http://distilleryimage2.s3.amazonaws.com/3686e48242f111e2b09522000a1f9363_7.jpg
http://distilleryimage0.s3.amazonaws.com/8e0a77da42bc11e2829522000a1fa769_7.jpg
http://distilleryimage8.s3.amazonaws.com/391ab854406211e292a022000a1faf61_7.jpg
http://distilleryimage9.s3.amazonaws.com/f9855a32406111e2aeda22000a1f973b_7.jpg
http://distilleryimage7.s3.amazonaws.com/9aa651fa3dc411e2943422000a9f1416_7.jpg
http://distilleryimage9.s3.amazonaws.com/68abaaea3db711e2b3af22000a1fb856_7.jpg
http://distilleryimage7.s3.amazonaws.com/6d795bbc3a8311e2952822000a1f9695_7.jpg
http://distilleryimage5.s3.amazonaws.com/1f95b6703a8311e2992f22000a1fb823_7.jpg
http://distilleryimage7.s3.amazonaws.com/c84360083a7211e2aa0322000a1fa408_7.jpg
http://distilleryimage9.s3.amazonaws.com/a8b490e03a6311e2a2e022000a1faf45_7.jpg
http://distilleryimage5.s3.amazonaws.com/6c68a1ee3a6311e28b4622000a9e2975_7.jpg
http://distilleryimage0.s3.amazonaws.com/8e4cc0a83a5211e2a9ed22000a1fb773_7.jpg
http://distilleryimage2.s3.amazonaws.com/5c7b44903a0811e2913d22000a9e2892_7.jpg
http://distilleryimage7.s3.amazonaws.com/42c7dffe3a0811e2ad6922000a1fa410_7.jpg
http://distilleryimage8.s3.amazonaws.com/7679309c2f5811e292a022000a1faf61_7.jpg
http://distilleryimage5.s3.amazonaws.com/8d35e49a2a0011e28dc022000a1f8c21_7.jpg
http://distilleryimage6.s3.amazonaws.com/470d9154260711e288f622000a1fbc72_7.jpg
http://distilleryimage10.s3.amazonaws.com/7934992025d511e283931231381b70f8_7.jpg
http://distilleryimage7.s3.amazonaws.com/f018a92e25ca11e28ed022000a1fbc58_7.jpg

upload di hosting anda lalu coba eksekusi smile
kalo berhasil tinggal setting cronjobnya

No comments:

handapeunpost