About phptuts

Author Archive | phptuts

jQuery printMe2 plugin

In some case, we cant use plugin printMe to print because of popup blocker, so how to use it, i create a new version call: printMe2 Homepage : printMe http://www.daniarlandis.es/printMe/ https://github.com/menusal/printMe And here the new code We use type=iframe, so can print in the case below. Example usage:

Read full story Comments { 0 }

Flash detect by Javascript

How to detect flash by Javascript

Read full story Comments { 0 }

Function apache_request_headers on Nginx

Function apache_request_headers supports only on Apache, how to use it on Nginx. Here is the solution:

Read full story Comments { 0 }

PHP CURL: How to limit read size

In some case, we need to read a first part of a website page or a file (eg a big file). How to limit read size? We can use CURLOPT_WRITEFUNCTION: Example 1: Example 2: get header and more information Result:

Read full story Comments { 0 }

How to install PHP5.6 php-fpm on Centos 7

Step 1: Result: Step 2: Result: Step 3: Step 4: Result: Step 5: Step 6: Result: Step 7: Result: Step 8: Result: Step 9:

Read full story Comments { 0 }

PHP: Example of usage CURLOPT_WRITEFUNCTION

CURLOPT_WRITEFUNCTION: A callback accepting two parameters. The first is the cURL resource, and the second is a string with the data to be written. The data must be saved by this callback. It must return the exact number of bytes written or the transfer will be aborted with an error. Result: Example 2:

Read full story Comments { 0 }

PHP: Example of usage CURLOPT_HEADERFUNCTION

If you set option CURLINFO_HEADER_OUT to true, you can get request header with function curl_getinfo (see example 2) CURLOPT_HEADERFUNCTION: A callback accepting two parameters. The first is the cURL resource, the second is a string with the header data to be written. The header data must be written by this callback. Return the number of […]

Read full story Comments { 0 }

How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Debian 8

Step 1: install nginx: Result: Step 2: Install MySQL Step 3: Install php-fpm and php5-mysql Result: Step 4: Edit file /etc/php5/fpm/php.ini Find line change to Step 5: Configure Nginx to use our PHP Example we edit file /etc/nginx/sites-available/default Done!

Read full story Comments { 0 }

How to install netstat on Linux

To install netstat on Linux, use one command line Result:

Read full story Comments { 0 }

PHP function chr of unicode character

PHP have function chr to find a character from a ASCII value. But PHP don’t support a function to find this with unicode character. Now, we provider some method, they are equivalent with String.fromCharCode() in Javascript: Examples:

Read full story Comments { 0 }