background preloader

Php

Facebook Twitter

React. Medoo - The lightest PHP database framework to accelerate development. Getting the real IP address of website visitors in PHP. Posted by Admin on September 22nd, 2012 Most of us should be relying on the server side environmental variable REMOTE_ADDR solely for client IP addresses.

Getting the real IP address of website visitors in PHP

But how to get the real IP address, when the user is visiting your website from a proxy server. Because at that time REMOTE_ADDR may not return the true IP address of the client. If your client is connected to the Internet through Proxy Server then $_SERVER['REMOTE_ADDR'] in PHP just returns the the IP address of the proxy server not of the client’s machine. So here is a simple function in PHP to find the real IP address of the client’s machine. So here is the solution. How to install and configure PHP 5 on Windows box.

It is assumed that you have already successfully setup IIS or installed Apache on your machine and configured it.

How to install and configure PHP 5 on Windows box

So, to configure PHP and secure its correct operation you need to go through a couple of steps. Download and unzip the latest version of PHP Download the latest zipped distribution of PHP from Unzip it. The recommendation is to put all the PHP stuff in a folder just off of the root drive (avoid whitespace), like C:\PHP. Rename/copy php.ini-recommended to php.ini In your PHP directory, you'll find a couple of php.ini-* files. Create a session state directory and point the session.save_path variable in php.ini to it This is optional, but recommended step.

Create a session directory somewhere on the server. 25 Best PHP Libraries for Web Developers. In the recent times, every business owner wants to have a successful website, there may be a different reasons for different business purposes, but the truth is that you can’t settle your online business until you have a great website.

25 Best PHP Libraries for Web Developers

There was a time when only HTML or CSS is sufficient to create some web pages but now every wants to have some stunning effect on their websites. These special navigation effects, slide shows require a lot of scripts and functions to get the job done. A number of languages like PHP, Javascript, ASP .Net, Ajax and some others are used for this purpose. But today we are going to talk about the PHP only, It offers too many useful extensions and features for the web developers to make stunning web sites. PHP Trends, libraries and frameworks. For PHP - Simplified, lightweight HTTP Request Library. Unirest is a set of lightweight HTTP libraries available in multiple languages.

for PHP - Simplified, lightweight HTTP Request Library

Features Utility methods to call GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH requestsSupports form parameters, file uploads and custom body entitiesSupports gzipSupports Basic, Digest, Negotiate, NTLM Authentication nativelyCustomizable timeoutCustomizable default headers for every request (DRY)Automatic JSON parsing into a native object for JSON responses Requirements Installation Using Composer To install unirest-php with Composer, just add the following to your composer.json file: or by running the following command:

Ajax Upload and Resize an Image with PHP. Today I am presenting the most important social networking feature called ajax upload and resize an image without refreshing the page using jquery and PHP.

Ajax Upload and Resize an Image with PHP.

This tutorial a continuation of my previous post, I just included image re-sizing function for different dimensions. It is very useful for your web project that saves lots of hosting space and bandwidth limit. Take a quick look at the live demo. Download Script Live Demo. How to Spruce up your Evolved PHP Application – Part 2. In the first part of my blog I covered the data side of the tuning process on my homegrown PHP application Spelix: database issues, caching on both the server and the client.

How to Spruce up your Evolved PHP Application – Part 2

By just applying these insights I could bring Spelix to a stage where the number of users could be increased by more than 150%, and user experience could be improved to make existing users eager to work with the system. By having more users contributing and delivering input, Spelix became more and more a platform for the caving community to meet and share their work. However, I did not stop my mission there. There was more to be done. Spelix offers a lot more functionality now thanks to performance improvements. In this part, I will concentrate more on technical topics: network traffic, code caching and session handling. Step #4: Reduce Network Traffic Functional extension of your application does not only require additional PHP code on your server, but also demands new logic on the client.

Tips & Tricks: Quickstart — Guzzle documentation. Guzzle provides several methods of uploading data.

Quickstart — Guzzle documentation

You can send requests that contain a stream of data by passing a string, resource returned from fopen, or a GuzzleHttp\Stream\StreamInterface object to the body request option. You can easily upload JSON data using the json request option. POST Requests In addition to specifying the raw data of a request using the body request option, Guzzle provides helpful abstractions over sending POST data.

Sending POST Fields Sending application/x-www-form-urlencoded POST requests requires that you specify the body of a POST request as an array. $response = $client->post(' [ 'body' => [ 'field_name' => 'abc', 'other_field' => '123' ]]); You can also build up POST requests before sending them.

Laravel

Nicmart/StringTemplate. 9 Most Useful PHP Code Snippets for Developers. Every Programmer and web developer loves talking about their favorite set of snippets and specially PHP developers who spend hours and hours coding websites and application, These guys know how important these snippets are.

9 Most Useful PHP Code Snippets for Developers

They are life savers for any serious coder. So before I give out my favorite Snippets, let me give you a brief of what a Snippet is and where one can use it to increase efficiency and saving time. All Coders who develop website, codes or Application knows the Importance of time. We live in an Age where there is a lot of c competition and to stay ahead, we need to be Productive and need to real quick in our work and results. So if you are a serious coder and want to show your expertise over others you need to have a set of resourceful Snippets that can do a specific task within larger coding projects.

Let me explain how a Snippet can save you time in the layman language. Flight - An extensible micro-framework for PHP. PHP Image Workshop - PHP class using GD library for image processing.