PHP Debug Log – Trace Errors

Hello Friends, I read some where “Quality is not a product.. it is a process 😉 ” I think process is hard-work we do and product is final result we get. But how we make our process to get a good product, as a LAMP developer I think track processes “Debug Log” is good sort … Read more

Download youtube videos using PEAR

PEAR have rich library to access web based resources easily… <?php $sv = new SVTube(); $sv->download(“D7cm-yu-CP0”, “svnlabs.flv”) ?> Class: SVTube.php —————————— <?php require_once ‘HTTP/Client.php’; require_once ‘HTTP/Request.php’; class SVTube { var $req; var $debug = false; var $auth = false; function download ($video_id, $video_filename) { $url = “https://www.youtube.com/watch?v=”.$video_id; $this->req =& new HTTP_Request($url); $response = $this->req->sendRequest(); if … Read more

Create ZIP archives with PHP script and PEAR class

We can use PEAR to process zip files in PHP using Archive_Zip…. First set PEAR path in php include path using set_include_path Make Zipped file <?php include (‘Archive/Zip.php’);        // include PEAR ZIP package $obj = new Archive_Zip(‘test.zip’);  // zipped file name $files = array(‘svnlabs/1.gif’, ‘svnlabs/resume.doc’, ‘svnlabs/invoice.xls’);   // files add to zip if ($obj->create($files)) { echo … Read more

PHP – File Upload Stream

PHP supports upload file stream… we can stream data to server using PHP stream_open() & stream_write() functions. There is alternate method in PEAR to transfer files to server1 to server2. PEAR have HTTP package for uploading files. HTTP_Request supports GET/POST/HEAD/TRACE/PUT/DELETE, Basic authentication, Proxy, Proxy Authentication, SSL, file uploads etc. <?php require_once “HTTP/Request.php”; $req =& new HTTP_Request(“http://domain.com/upload”); $req->setBasicAuth(“login”, “pass”); $req->setMethod(HTTP_REQUEST_METHOD_POST); $result = $req->addFile(“data”, “/home/svnlabs.mp4”); … Read more

Magic of PEAR – Date TimeZone

PEAR is a framework and distribution system for reusable PHP components. How we get PEAR packages with php files? Add block of code to the php file…. <?php // include PEAR class include (“Date.php”); // initialize Date object $d = new Date(“1981-08-07 01:30:11”); // retrieve date to display echo $d->getDate(); // retrieve date as formatted … Read more