PHP
URL’s Content Using PHP cURL
Downloading content at a specific URL is common practice on the internet, especially due to increased usage of web services and APIs offered by Amazon, Alexa, Digg, etc. PHP’s cURL library, which often comes with default shared hosting configurations, allows web developers to complete this task. The Code: 1 2 3 4 5 6 7 [...]
PHP File Upload Tutorial
This tutorial will demonstrate how to handle file uploads in PHP. We will create a simple XHTML form with a file field, and a PHP script that handles the form submission by moving the uploaded file to a designated directory. This tutorial assumes you are using PHP 4.4.0 or higher. XHTML for the File Upload [...]
Website Thumbnail Generator PHP Script
Requirements: Windows hosting PHP GD library (installed on most hostings) Permissions to execute third-party applications (i.e. exe files) Permissions to execute Internet Explorer How it works: Website Thumbnail Generator checks if it already has website image in the cache, and shows it in the browser. If no cached image then IECapt would be run [...]
php file list recursively function
With this function you get list of all files, file sizes as well, and directories!
Unzip with PHP
Unzip File PHP Code <?php $zip = zip_open(“zip.zip”); if ($zip) { while ($zip_entry = zip_read($zip)) { $fp = fopen(“zip/”.zip_entry_name($zip_entry), “w”); if (zip_entry_open($zip, $zip_entry, “r”)) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,”$buf”); zip_entry_close($zip_entry); fclose($fp); } } zip_close($zip); } ?>
Unzip an uploaded file using php
If you dont have shell access to your server and need to unzip a file on your php server you can use the script below: <?php $zip = new ZipArchive; $res = $zip->open(’my_zip_file.zip’); if ($res === TRUE) { $zip->extractTo(’my_extract_to_dir/’); $zip->close(); echo ‘ok’; } else { echo ‘failed’; } ?> Info from http://www.bjw.co.nz
PHP: Function to delete directory and its contents
A function to delete a directory and all its contents on the web server. Parameters $dir – The path of the directory $virtual (optional) – If true assumes the path given is a virtual path and if false assumes it is an absolute path. This parameter defaults to false. function destroyDir($dir, $virtual = false) { [...]
![[Google]]( http://www.network-content.com/wp-content/plugins/easy-adsense-lite/google-light.gif)