Category Archives: Coding

All kinds of Programming.

3 ways to serialize variables in php

By | July 14, 2012

The idea behind serializing a variable is to create a storable string format of it, such that the same variable can be recreated later when required using the string. 1. serialize and unserialize These are the traditional functions to serialize and unserialize data in PHP. When the array values contain characters like the double quote,… Read More »

PHP : Add Login with Github to your website

By | July 13, 2012

Github Login Github has become a very popular social login on websites related to programming and development. Github itself is a big storehouse of opensource projects and community of developers. Github oAuth documentation can be found at http://developer.github.com/v3/oauth/. Register website with Github oAuth The first thing to do would be to register your website with… Read More »

Use clientside ssl certificate with curl and php

By | June 13, 2012

Clientside certificates are often used in soap webservices. For example the wsdl file link might require a clientside certificate. The server throws an error like this : HTTP Error 403.7 – Forbidden: SSL client certificate is required. Curl Command To use clientside certificate with curl , test the following command curl –cert certificate_file.pem https://www.example.com/some_protected_page or… Read More »

40+ Useful Php tips for beginners – Part 3

By | April 7, 2012

Part 2 26. Avoid direct SQL query , abstract it The above is the simplest way way of writing sql queries and interacting with databases for operations like INSERT, UPDATE, DELETE etc. But it has few drawbacks like: All values have to be escaped everytime manually Manually verify the sql syntax everytime. Wrong queries may… Read More »

40+ Useful Php tips for beginners – Part 2

By | April 7, 2012

Part 1 11. Do not gzip output in your application , make apache do that Thinking of using ob_gzhandler ? No dont do that. It doesnt make sense. Php is supposed to write your application. Dont worry about how to optimise data transfer between server and browser inside Php. Use apache mod_gzip/mod_deflate to compress content… Read More »