Export To CSV File – PHP

CSV is a simple file format that is widely used by IT Professional, business, and all who are familar with computer. Those who use computer in day to day life, they know how to use CSV/Excel. Among its most common uses is to move tabular data between programs that naturally operate on a more efficient or complete proprietary format. This file is easily readable even in mobile with use of some basic apps.

In Web Technology fileld,  number of times we have the send Stats, Logs and detail to our client in Form of CSV files.  Event may times we got the Text in form of excel/CSV Fle.
Now, Export the PHP data into CSV is very simple. Just  you need to do few simple steps.
  1. Save into into PHP multidimensional array
  2. Set the header
  3. Now, render the rows and then render EOL (First Row)
  4. Now, render the rows and then render EOL (Second Row)
  5. Now, render the rows and then render EOL  (Third Row and so on)
 Here EOL is End of Line.

$lists = array(
        'Web', 'Technology', 'Experts', 'Notes',
        'Web1', 'Technology1', 'Experts1', 'Notes1',
        'Web2', 'Technology2', 'Experts2', 'Notes2'
        'Web3', 'Technology3', 'Experts3', 'Notes3',
        'Web4', 'Technology4', 'Experts4', 'Notes4',
        'Web5', 'Technology6', 'Experts5', 'Notes5',

header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=csv.csv");
header("Pragma: no-cache");
header("Expires: 0");

echo  "Title1, Title2,Title3, Title4 \n";

foreach ($lists as $list) {
    echo implode(',', $list);
    echo PHP_EOL;

WordPress Web Development Advantages

1. Flexibility and lower cost of development: Being an open source CMS WordPress is free, does not involve licensing cost and has no restrictions on modifications, additions or changes to the code.
2. Customizable: WordPress CMS is the ideal platform to build websites customized to any requirements or budget,be it a small individual website, blog, an e-commerce website or a complex web portal optimized for search engines.
3. WordPress has a large pool of themes and ready-made plugins.
4. Using WordPress you can build powerful, intuitive, interactive, visually engaging and feature rich websites as it has rich in text editors as well as rich multimedia support like high definition images, audio, video, animation,etc.
5. It is easy to use, configure and setup, it is simple & convenient and does not need specialized programming kills.
6. WordPress comes packed with all core features like membership management and content management and provides powerful search engine optimization features built in to the site to handle traffic intensive websites capable of handling high loads while still remaining responsive.
7. WordPress provides multi-lingual support and easy administrative interface for managing websites including multi user accounts, role assignments, workflows, menu management, and layout customizations.


In previous articular we have discus Migrate site from ASP to WordPress

After successfully migration your ASP site to WordPress it’s important to maintain redirection. Because If you have an old url ranking is good in Google and move to a new, permanent location, a 301 redirect can pass the search engine ranking score of the old ranking URL (not abruptly; it will take time) to the new URL. Hence the new URL will appear and start to rank in the search engine results, replacing the old URL.

Before discuss on this topic need to know about Permalink

Permalink means “Permanent Link”. It is a unique URL for each article on your blog. Even if you publish two posts with the same title, they get different permalinks.

A permalink is generated when you hit the publish button for a post or page. It remains the same after publishing, even if you make changes to the title. That is why it is called a permanent link!

On the Internet, a permalink represents a unique address for each of your blog posts and other stuff. So if a permalink breaks, your visitors will be lost.

Similarly on the Internet, if a permalink breaks, the visitors coming from search engines, social media, bookmarks, backlinks from others posts will be lost.


Maintaining Permalinks

Try to set your permalink to similar to your old site url.


As you know by now, when you move your site from (ASP) to WordPress, permalink structure gets altered. you can use some WordPress plugin for redirection.

But there are Few known limitations of redirecting permalinks are:

  • Facebook/Twitter count will reset for sure. New permalink will have all zeros.
  • Google pagerank for new permalink will be zero. New permalink may gain Google pagerank over the time but big risk.
  • Human visitors will notice delay in opening your posts on WordPress. Delay will be obvious if they are using slow Internet connection.

If you do not take any extra effort to use to maintain permalink and redirection then you will loose traffic, ranking and of-course Google AdSense revenue from your blog.

Google pagerank can be retained if you maintain permalink and redirection.


Improve Ajax Performance

Following are few steps to Improve Ajax Performance

  1. First try to Reduce the Number of Ajax Call
  2. If same call send again, abort the previous call
  3. If ajax call is executing, and user go for another link, then cancel the previous one.
  4. Use GET Method, As its Fast but less secure
  5. Reduce the Amount of data transmitted
    a. Only Required parameter in Ajax Request
    b. Only Required Response in Ajax Request
  6. Optimize your Server

How To Fix Headers Already Sent Error In PHP?

We are here to fix below error in PHP
Warning: Cannot modify header information – headers already sent by (output started at E:\wamp\www\testp\public_html\test.php:2) in E:\wamp\www\testp\public_html\test.php on line 4

Question: Why this Error comes? This error comes when sending header after the output.
using “header” function after the output.

Question: Give an example when this error comes?

echo "arun";
header("Location: next.php");

Question: How to fix this error?
When you are using header function to send header, make sure you have not any output before. In another words, header function must be called first in any script(if applicable). you can not send header after the output. For Example: below will work 
header("Location: next.php");
echo "arun";
Question: Is there any another way to fix this error?
Yes, you need to set the output_buffering "on" (By default it is off)

Question: How to set output_buffering on in PHP?

Question: How to set output_buffering on in php.ini?
output_buffering = Off
replace with
output_buffering = On

Question: How to set output_buffering on in htaccess?
open you .htacces file and add following code.
  php_value output_buffering On


Representational state transfer (REST) is the software architectural style of the World Wide Web.It relies on a stateless, client-server, cacheable communications protocol — and in virtually all cases, the HTTP protocol is used.

REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.).

Despite being simple, REST is fully-featured; there’s basically nothing you can do in Web Services that can’t be done with a RESTful architecture. REST is not a “standard”. There will never be a W3C recommendataion for REST, for example. And while there are REST programming frameworks, working with REST is so simple that you can often “roll your own” with standard library features in languages like PHP, Perl, Java, or C#.
REST was defined by Roy Thomas Fielding in his 2000 PhD dissertation “Architectural Styles and the Design of Network-based Software Architectures”.
REST is the underlying architectural principle of the web. The amazing thing about the web is the fact that clients (browsers) and servers can interact in complex ways without the client knowing anything beforehand about the server and the resources it hosts. The key constraint is that the server and client must both agree on the media used, which in the case of the web is HTML.

An API that adheres to the principles of REST does not require the client to know anything about the structure of the API. Rather, the server needs to provide whatever information the client needs to interact with the service. An HTML form is an example of this: The server specifies the location of the resource, and the required fields. The browser doesn’t know in advance where to submit the information, and it doesn’t know in advance what information to submit. Both forms of information are entirely supplied by the server.

So, how does this apply to HTTP, and how can it be implemented in practice? HTTP is oriented around verbs and resources. The two verbs in mainstream usage are GET and POST, which I think everyone will recognize. However, the HTTP standard defines several others such as PUT and DELETE. These verbs are then applied to resources, according to the instructions provided by the server.resources being manipulated using a common set of verbs: HTTP methods are the commonly seen case – the venerable Create, Retrieve, Update, Delete becomes POST, GET, PUT, and DELETE

For example, Let’s imagine that we have a user database that is managed by a web service. Our service uses a custom hypermedia based on JSON, for which we assign the mimetypeapplication/json+userdb (There might also be an application/xml+userdb andapplication/whatever+userdb – many media types may be supported). The client and the server has both been programmed to understand this format, but they don’t know anything about each other.

The REST API lets you interact with Parse from anything that can send an HTTP request. There are many things you can do with the REST API. For example:

  • A mobile website can access Parse data from JavaScript.
  • A webserver can show data from Parse on a website.
  • You can upload large amounts of data that will later be consumed in a mobile app.
  • You can download recent data to run your own custom analytics.
  • Applications written in any programming language can interact with data on Parse.
  • You can export all of your data if you no longer want to use Parse.

Cloud Computing (Salesforce) and Salesforce Integration with PHP

Cloud computing is Internet-based computing, whereby shared resources, software, and information are provided to computers and other devices on demand, like the electricity grid.

Cloud computing is the use of computing resources (hardware and software) that are delivered as a service over a network (typically the Internet).

As a metaphor for the Internet, “the cloud” is a familiar cliché, but when combined with “computing,” the meaning gets bigger and fuzzier.

Some analysts and vendors define cloud computing narrowly as an updated version of utility computing: Basically virtual servers available over the Internet.

Benefits of Cloud

  • Lower Costs – Cost savings that come with economy of scale
  • Scale as Needed – As your applications grow, you can add storage, RAM and CPU capacity as needed.
  • Cap-Ex Free Computing cash flow by eliminating the capital expense associated with building the server infrastructure
  • Deploy Projects Faster – Because servers can be brought up & destroyed in a matter of minutes.
  • Lower Maintenance Costs driven by 2 factors: Less hardware and outsourced, shared IT staff.
  • Resiliency and Redundancy –you can get automatic failover between hardware platforms and disaster recovery services
  • Guaranteed “up time“
  • Software upgrades are provided with no cost and avoids obsolescence
  • More available Capital to promote business growth

Cloud service models


Cloud Service Available

The Cloud fits into a broad categorization of service offerings split out into,

Infrastructure as a Service (e.g. Amazon EC2 and Rackspace),

Platform as a Service (e.g. App Engine)

Platform as a service (PaaS) is a category of cloud computing services that provides a computing platform and a solution stack as a service. The provider provides the networks, servers, storage, and other services that are required to host the consumer’s application

Software as a Service (e.g. Salesforce.com).

Software as a service (SaaS) is a software distribution model in which applications are hosted by a vendor or service provider and made available to customers over a network, typically the Internet.


The Fear of Cloud

  •   72% cited Security concernscloud_use_graph
  •    34% selected Integration issues
  •    14% cited TCO
  •     8% none of the above


Security of customer data has been the #1 priority of Saas companies today.

They maintain the highest security standards at three levels: Application Security, Facilities security & Network securitysalesforce


Salesforce.com is the Enterprise Cloud Computing Company.

  • Salesforce is originally a Customer Relationship Management (CRM) software.
  • CRM is originally software for managing customer interaction, such as scheduling tasks, emailing, texting, and many more tasks.
  • Salesforce grew into a cloud software solution and acquired several other companies for Paas and Saas.

Salesforce is also 3-tier, but many of the internals are handled through abstraction. There are:

1) Out-of-box interfaces, which include security, dashboards, workflow, and user interfaces. Coding is optional.

2) VisualForce is an editor for customization of User Interfaces if not out-of-box.

Visualforce is a framework that allows developers to build sophisticated, custom user interfaces that can be hosted natively on the Force.com platform. The Visualforce framework includes a tag-based markup language, similar to HTML, and a set of server-side “standard controllers” that make basic database operations, such as queries and saves, very simple to perform.

3) Apex, using the developer console, is for writing code to the Salesforce API, for example a SOAP or batch application for importing custom data.

Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the Force.com platform server in conjunction with calls to the Force.com API. Using syntax that looks like Java and acts like database stored procedures, Apex enables developers to add business logic.

Salesforce in Business

Salesforce in Business

Salesforce Offers

Sales Cloud 2Sales Cloud 2 :  

The world’s #1 sales application

Give reps, managers and execs everything they need to focus on what’s important: more selling and less administration.

  • Close more deals — faster
  • Gain real-time visibility into sales
  • Collaborate instantly and know what matters


Service Cloud 2Service Cloud 2 : 

The future of customer service

Provide faster, more responsive service across every channel — from the call center to the social Web.

With the Service Cloud 2, you can:

  • Keep agents productive
  • Reduce service costs
  • Satisfy every customer


ChatterChatter :  

The real-time Collaboration Cloud

Chatter is a brand-new way to collaborate with people at work. Where the status of important projects and deals are automatically pushed to you — so you’re always in the loop.

  • Share securely and collaborate instantly
  • Stay on top of what matters most
  • Gain insight and make smarter decisions


Force.comForce.com : 

The leading cloud platform for business apps

Give developers a platform to create rich, collaborative cloud apps fast—without buying hardware or installing software.

  • Build apps 5 times faster, at 1/2 the cost
  • Deploy apps easily to anyone, anywhere
  • Make apps instantly collaborative and mobile

Salesforce Integration with PHP

  • Web Services API
  • PHP Toolkit

We can easily access the salesforce objects, fields & data using below is the basic steps to Integration Between Salesforce and PHP.
Salesforce providing support to PHP and delivered the PHP Toolkit. Using this toolkit we can connect with salesforce and perform all API operations supported like Insert, Update, Delete, Retrieve the data and much more.

Salesforce PHP Toolkit Requires is,
PHP 5.x
SOAP Enabled
SSL Enabled
cURL Enabled
OpenSSL Enabled

Download the latest PHP toolkit using below URL

PHP Toolkit: http://wiki.developerforce.com/page/Force.com_Toolkit_for_PHP
unzip the folder(soapclient Folder) and paste it in your PHP Htdocs Folder (Ex: PHP Project Folder Name is “PHP_SFDC”)

The WSDL file can be downloaded from wihin your SALESFORCE Org. Once you login to Salesforce, go to Setup > App Setup > Develop > API and then you can generate a Partner WSDL or Enterprise WSDL file from there and and save it to your PHP Project Folder(www/Htdocs/PHP_SFDC/partner.wsdl)

In PHP Project Folder (PHP_SFDC), Create a new File called getRecord.php file and save it to www/Htdocs/PHP_SFDC/getRecord.php path

add the following lines to getRecord.php file

Retriving the Salesforce Contact Record using PHP
ini_set("soap.wsdl_cache_enabled", "0");
// PHP Tool Kit class scripts to login to Salesforce Org
require_once ('../includes/soapclient/SforcePartnerClient.php');
require_once ('../includes/soapclient/SforceHeaderOptions.php');
// Salesforce Login information
$wsdl = 'partner.wsdl.xml';    // PARTNER WSDL FILE PATH
$userName = "salesforce username";
$password = "salesforce password"; // PASSWORD SHOULD BE COMBINATION OF "PASSWORD + SECURITY TOKEN", if it's a Developer ORG.
// Process of logging on and getting a salesforce.com session
$client = new SforcePartnerClient();
$loginResult = $client->login($userName, $password);
//Then perform to get your Contact records from Your Salesforce ORG
$query = "SELECT Id, FirstName, LastName, Phone from Contact";
$response = $loginResult->query($query);
foreach ($response->records as $record)
echo '<tr>

Best WordPress Plugin for Improving Your Customer Service

I have search many support plugin for WPSeeds support and finally  found most popular WP Support Plus plugin.

The plugin works great, installation and configuration are very simple, and customization is a breeze.

It seems like a very nice and clean plug-in so far. It is great for someone who needs something quickly and make it up.

And most important is  No need Third Party Support Services.

This plugin adds to WordPress the features of a complete ticket system with 100% responsive and 100% Ajax functionality. This allows users to submit tickets to report problems or get support on whatever you want. Users can set the status, priority and category of each ticket.

This one adds a ticketing system where users can submit a ticket to get support. The users can set the status, priority, and category of each ticket. Tickets can be submitted through the admin panel or through the frontend. They can attach files to the tickets and to email.

It adds a nice dashboard that’s intuitive to use. The dashboard shows you the tickets along with their subject, status, when it was submitted, etc. You can click on each ticket to handle it. You can also sort the tickets by status, type, category, and priority. There is a search feature so you can search through them to see history or find something specific. And you can create a ticket form this dashboard if you want to create it yourself. There is also a tab for Agents where you can set the agent’s signature.

You create the support page by choosing the page or post from a dropdown list and then placing a shortcode on that page or post. It will also give you a support button that will appear on your site. You can choose its location from a list of choices. It will add a captcha to avoid spam and you will receive the ticket in the admin panel and as an email.

You can get more pro features on following link :