Saturday, February 25, 2012

Reduce HTTP Request with Data URI in PHP


A part of website optimization technique is Reduce no of HTTP Request when user attempt to open our Web page from our website. HTTP Request count is an important factor for Traffic worthy websites to make your web pages / websites more responsive on time. In this factor of HTTP Request optimization to reduce the HTTP request count of various images in our websites by Rewriting with Data URI Scheme. Data URI is the technology which is used to Reduce and Optimize HTTP request and response.



For example If you have a gallery section in your website. Gallery images are in two Sections one is Thumbnails and another one is actual images. in this case set of 5 Images will request 10 HTTP request every time the Page opens. in this case we can use Data URI with PHP to reduce this HTTP request 0, Data URI will cheat our server and retrieve the image data as plain code along with our standard HTML code.

Friday, February 24, 2012

Login with Twitter OAuth Integration

Today we are going to see how to integrate Twitter OAuth Login Authentication with our website. Let us start How to integrate Login with Twitter Button in our website.

In order to Integrate Twitter Login for your website you need to obtain your Twitter Consumer key and Consumer secret.


Steps to get Twitter Consumer Key and Consumer Secret as follows:
1. Go to : https://dev.twitter.com/ and Login with your Twitter Account credential 




 2. On Top Right Drop down Menu Choose My Applications
















3. In this area twitter list our existing apps. Create a First one by Choosing "Create a New Application"














Wednesday, February 22, 2012

Directory Model URL Rewriting with htaccess and map content with php

Creating a dynamic content for web application, we need to consider the Search Engine Optimized web URL structure to main the quality of our web development says "SEO Friendly", Search Engines are clearly identified our web content if we have Directory Model URL structure in our websites. As a developer SEO Friendly URL is very important to any project. Let me explain How to create Directory Model URL Rewriting with htaccess and how to map your content with php.

.htaccess directory structure url rewriting



directory structure:

/index.php
/.htaccess
/include/home.php
/include/about_us.php
/include/contact_us.php

Wednesday, February 8, 2012

Prevent Browser cache PHP

Working with PHP in some times we need to avoid browser cache, Browser cache will cases you to prevent page updates when ever we work on Self Data POST in PHP,

Here I give the solution to prevent the Browser cache when reloading current page. and re-download the actual page with dynamic content.
header( "Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
header( "Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
header( "Cache-Control: post-check=0, pre-check=0", FALSE );
header( "Pragma: no-cache" ); // HTTP/1.0