Pengen download video dari youtube? ngapain susah. nih gue kasih demo nya buat elo2 pada pake php. DEMO dan download script dapat dilihat di sini. <?php /* * youtube url downloader v0.2 – after youtube upgrade 29 agustus 2009 * * by lemonade <firman@maxindo.net> * donation is very appreciated, paypal: cool01@indosat.net.id * * * ChangeLog * * v0.2 * 27/10/2009 – new parsing for youtube. * * v0.1 * 25/09/2009 – small fix for FLV url. * */ if(!empty($_REQUEST[‘yid’])) { $yid = trim($_REQUEST[‘yid’]); $yid = urldecode(rawurldecode($yid)); if (preg_match(‘%http://www.youtube.com/watch?v=(.*)%s’, $yid, $regs)) { […]
Contoh client-server chatting (single client) menggunakan PHP socket. Server.php <?php //The Server error_reporting(E_ALL); $address = “127.0.0.1”; $port = “10000”; /* create a socket in the AF_INET family, using SOCK_STREAM for TCP connection */ $mysock = socket_create(AF_INET, SOCK_STREAM, 0); // if socket is uses, we reuse it if (!socket_set_option($mysock, SOL_SOCKET, SO_REUSEADDR, 1)) { echo socket_strerror(socket_last_error($mysock)); exit; […]
Session adalah temporary variable yang dibuat oleh server side scripting, oleh sebab itu javascript (client side scripting)tidak bisa membaca session/menulis secara directly tanpa bantuan server side scripting. Contoh session javascript + php: (http://download.indolayer.com/tmp/test1.php) <?php // test1.php session_start(); $_SESSION[‘dodol’] = “apa aja deh”; ?> <html> <head> <title> test session </title> </head> <body> <script type=”text/javascript”> var apple_s […]