Actually, even if in your hosting does not have Cron Job feature, you can use an external free Cron Job. But, it will be discussed separately later.
Before we make it, you need to know few things below:
- Have an active virtual hosting (if you haven't yet you can use Apa Dong (dot) Biz hosting service);
- Cron Job facilities in virtual hosting;
- Knowledge of managing cPanel;
- Knowledge of FTP;
- Knowledge of the basics of editing a PHP file;
- A clean heart and clear mind (hehehe... :D)
Ok let's get started:
- Log in to your Plurk account.
- Register Plurk API (FREE!) in http://www.plurk.com/API. Save your e-mail containing your Plurk API's information carefully.
- Download the PHP file Plurk API package from https://code.google.com/p/php-api-plurk. Usually there is on the left sidebar, under the Featured Download, with name php-plurk-api-*.*.*.zip. Please divided once downloaded.
- Using your favorite text editor (Notepad, Smultron, Text Edit, anything), please copy and attach the code below:
<?php
require('php-plurk-api/plurk_api.php');
$api_key = 'your-plurk-api-key';
$username = 'your-plurk-username';
$password = 'your-plurk-password';
$messages = array(
'05:00' => 'bot subuh',
'12:00' => 'bot tengah hari',
'19:00' => 'bot petang',
'00:00' => 'bot tengah malam',
'02:00' => 'bot dini hari'
);
$plurk = new plurk_api();
$plurk->login($api_key, $username, $password);
$time = date("H:i");
if ($messages[$time] !== NULL){
$message = $messages[$time];
$plurk->add_plurk('en', ':', $message);
}
?>
- Edit $api_key, $username and $password with the correct information related to your Plurk account.
- Edit the array(), adjust to your taste and needs.
- Save it, for example with the name plurkbot.php.
- Open your FTP account and create a new directory with the name plurk.
- Upload plurkbot.php to that new directory.
- Also upload one complete folder php-api-plurk which already downloaded in step 3 above, with all the contents into that new directory also.
- Next let's log into your cPanel Hosting to activate Cron Job, usually named http://yourdomain.com/cpanel
- Search in the Advanced section, there you will find Cron Jobs menu.
- At the Cron Emails enter your valid email address. This is optional, but should be done to monitor the activities of Cron Job. In addition, to avoid piling the logs on the server hosting.
- Add New Cron Job, my suggestion Common Settings: Once an hour to avoid excessive CPU usage on the server.
- Enter /usr/bin/php /home/your-cPanel-username/plurk/plurkbot.php into the Command box. Pleace replace this address with your directory address to your plurkbot.php file in your cPanel.
Note: there's space between /usr/bin/php and /home/your-cPanel-username... - Click the Add New Cron Job button.
Hope you like it!
1 comments on "How to Make Plurk Bot Auto Status"
i cant the url of google plurk not working
Post a Comment