Monthly Archives: August 2011

The fastest way to copy file to server|Langkah cepat salin fail ke dalam server

[lang_en-us]Last time, I will download wordpress file from wordpress.org download page to my local computer. After that, I will upload it to my web server throught FTP or cpanel filemanager. This step sometime will took a long time to upload and download depending on out internet connection. To handle this problem, I was code a simple php program to help me download wordpress file directly from wordpress.org to my server. It’s work for me and only took a few second to download that file. For me it’s really fast compared to manual download and upload.

You can try this code and see it ;) [/lang_en-us]

[lang_ms-my]Dulu biasanya saya akan download wordpress dari lelaman wordpress.org dan upload semula ke server melalui FTP. Cara ini agak lambat lebih-lebih lagi bila sambungan ke internet terlalu perlahan. Untuk menyelesaikan masalah ini, saya code program mudah untuk download fail wordpress dari lelaman wordpress.org terus ke server. Nampaknya proses muat-turun hanya mengambil beberapa saat sahaja.. ini sudah baik hehe.

Jika korang nak cuba… boleh gunakan kod dibawah. Muat-naik kod dibawah kedalam webserver korang dan larikan program tersebut.[/lang_ms-my]

	$str = file_get_contents('http://wordpress.org/latest.zip');
	$handle = fopen ('wordpress.zip', 'w'); 
	fwrite ($handle, $str);
	fclose ($handle); 

How to use rapidshare API | Bagaimana menggunakan API rapidshare

[lang_en-us]Friend of mine at php.net.my was asking about how to get rapidshare traffic left from his rapidshare accoung and show it into his web page. Below is the solution for him… maybe it’s also useful for you

rapidshare does provide APIs to enable developers to develop applications that connect to rapidshare.For more information, you can read APIs detail at http://rapidshare.com/dev.html and http://images.rapidshare.com/apidoc.txt .

How to use rapidshare APIs?.

It’s pretty simple.. you can sent GET request to rapidshare as below[/lang_en-us]

[lang_ms-my]seorang dari rakan di php.net.my bertanyakan mengenai bagaimana untuk mendapatkan traffic left rapidshare dan ingin memaparkannya didalam laman web beliau. Dibawah ini saya sertakan penyelesaiannya yang mungkin boleh dikongsi bersama.

rapidshare ada menyediakan API bagi membolehkan para developer membangunkan aplikasi yang disambung kepada rapidshare.untuk maklumat lanjut, korang boleh tengok disini http://rapidshare.com/dev.html dan http://images.rapidshare.com/apidoc.txt bagi senarai fungsi API yang boleh digunakan.

untuk menggunakan API rapidshare ini, korang hanya perlu hantar permintaan ke rapidshare dengan menggunakan URI dengan format dibawah[/lang_ms-my]

http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=subroutine (finalpoints=points)
or https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=subroutine (finalpoints=points*2 (this means using SSL doubles points!))

Additional parameters can be added via http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=subroutine&param1=value1&param2=value2

[lang_en-us]Subroutine is referring to function that you can use to get rapidshare data. You can read API functions list from API documentation here http://images.rapidshare.com/apidoc.txt

Sample php code[/lang_en-us]

[lang_ms-my]Subroutine disini merujuk kepada function yang tersenarai didalam dokumentasi API http://images.rapidshare.com/apidoc.txt . korang juga boleh hartar beberapa parameter tambahan didalam URL tersebut

contoh kod php[/lang_ms-my]


$account_type = 'prem'; //type=col or prem (Collector's account or Premium account.)
$rs_login = 'RAPIDSHARE-USERNAME'; //contoh 12345678
$rs_password = 'RAPIDSHARE-PASSWORD'; 


$content = file_get_contents('http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=' . $account_type . '&login=' . $rs_login . '&password=' . $rs_password );
$content = explode("n",$content,-1);
foreach( $content as $value){
	$arg = explode("=",$value);
	$data[$arg[0]] = $arg[1];
}

print_r( $data);