Archive for the ‘PHP’ Category

[PHP] Force download the files

Some time you may want the user download the file instead of direct open in the browser.
(e.g. The PDF reader add-on will be directly open the PDF in the browser)

You just need modify the http headers and set the content type to force-download, the problem will be solved.

The following is the demo and the source code:

Read the rest of this entry »


[PHP] PHPExcel – The Powerful Excel Library

PHPExcel is an powerful class for read & write excel files, it is very useful in the report generation. You can easily to use PHPExcel to create the true and new version excel files, not are outdated excel formats.

PHPExcel providing a set of classes for the PHP programming language, which allow you to write to and read from different file formats, like Excel 2007, PDF, HTML, … This project is built around Microsoft’s OpenXML standard and PHP.
This class set provides, such as setting spreadsheet meta data (author, title, description, …), multiple worksheets, different fonts and font styles, cell borders, fills, gradients, adding images to your spreadsheet and much, much more!

Quoted from PHPExcel homepage

Read the rest of this entry »


[PHP] PHPMailer – The Mail Library

The PHPMailer a powerful and most popular email transport class with a big features and small footprint that is simple to use and integrate into your own software.

PHPMailer is free and release under LGPL license.

Full Featured Email Transfer Class for PHP. PHPMailer features:

  • Supports emails digitally signed with S/MIME encryption!
  • Supports emails with multiple TOs, CCs, BCCs and REPLY-TOs
  • Works on any platform.
  • Supports Text & HTML emails.
  • Embedded image support.
  • Multipart/alternative emails for mail clients that do not read HTML email.
  • Flexible debugging.
  • Custom mail headers.
  • Redundant SMTP servers.
  • Support for 8bit, base64, binary, and quoted-printable encoding.
  • Word wrap.
  • Multiple fs, string, and binary attachments (those from database, string, etc).
  • SMTP authentication.
  • Tested on multiple SMTP servers: Sendmail, qmail, Postfix, Gmail, Imail, Exchange, etc.
  • Good documentation, many examples included in download.
  • It’s swift, small, and simple.

Quoted from PHPMailer homepage

Read the rest of this entry »


[PHP] Web Proxy – PHProxy

PHProxy is free and open source web proxy application, under GNU General Public License (GPL) license.
It is no longer under active development, but still is a best.

PHProxy is a web HTTP proxy programmed in PHP meant to bypass firewalls and access otherwise inaccessible resources (i.e. blocked websites). If the server this script is run on can access a resource, so can you!

Quoted from PHProxy sourceforge project page

Read the rest of this entry »


[PHP] jQuery PHP Edition? phpQuery!

phpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library.

Library is written in PHP5 and provides additional Command Line Interface (CLI).

Quoted from phpQuery homepage

phpQuery is a great library for processing HTML/DOM content. You can easily to use it, if you has experience in the jQuery. I always use this for data capture, the Selectors feature is powerful and save time.

Read the rest of this entry »


[PHP] Detect and handle execution timeout error

Sometime php will throw unhandled exception, e.g. over maximum execution time limit. you may want some method to detect and handle them.

Read the rest of this entry »


[PHP] Dreamweaver too many connections error

I am not using dreamweaver to develop my php code, but i replied the question about `mysql too many connection error` in experts-exchange. The problem is the question author used the dreamweaver to create website and connect mysql database, however they always get the `too many connection error`.

The reasons is default dreamweaver will using pconnect() to connect database, have are simple solutions is modify dreamweaver scripts library.

Read the rest of this entry »


[PHP] Generate possible letter combination

Sometime you may want to generate the list of all letter combination like `A to Z`, PHP provided the built-in function range(). But if you need the range like `BB to ZZZ`? my customize function may help.

PHP built-in function range()
A ~ Z

ycTIN customize function ycRange()
A ~ ZZZ (unlimited)

Read the rest of this entry »


[PHP] How to call webservice without WSDL

So simple, see below.

Read the rest of this entry »


[PHP] Using output buffering to create static page

A example to show how to using the php output buffer, create the static html page.
Read the rest of this entry »