php

How to create excel files in PHP?

Some time ago I found a class on phpclasses.org by Harish Chauhan which makes it incredibly easy to generate simple excel spreadsheets from PHP. I found it useful so I want to share its usgae with readers too. I also made some changes to the class for styling the rows.

Here is the process:
1- Include [...]

Read the rest of this entry >>

FAQ, php

Creating an XML in PHP using DOMDocument

In this tutorial you will learn how to create XML documents using PHP’s DOMDocument class.
First things first.There are 3 things that you should always keep in mind about XML. In short, XML has 3 main components.

Elements, which we also call nodes. e.g.

<name />

Attributes e.g

<name type="first"/>

Here type is an attribute.
Data/text nodes

<name type="first">Johnson</name>

[...]

Read the rest of this entry >>

php, xml

Collection of 10 top 10 lists about web development

I am a regular reader of web development articles and in this process bookmark a lot of them. Out of that collection I present to you a list of 10 articles which themselves are lists of 10(tips, functions etc). Not all of them are top 10 but equally good. All these articles are [...]

Read the rest of this entry >>

ajax, javascript, php

Quick PHP Tip: How to parse CDATA sections using SimpleXML

Applies to:  simplexml_load_string and simplexml_load_file
Problem : SimpleXML does not parse text inside CDATA tags in an XML.
Consider the XML below:

 
$str = ‘<rootNode>’;
$str.=’<childNode>some text goes here</childNode>’;
$str.=’</rootNode>’;

To parse it we use following syntax:

$xml = simplexml_load_string($str);

On printing it outputs:

 
SimpleXMLElement Object
(
[childNode] => some text goes here
)

Thats OK. Now the same xml but this time the [...]

Read the rest of this entry >>

FAQ, php

Super simple way to expand bitly urls using PHP

OK. Agree that bit.ly provides an API for expanding URL’s. The main purpose of our simple exercise here is to use  curl functions in PHP to achieve the same. We will write a simple function that will accept a bitly url as parameter. Then we will use curl to get the expanded url.
Below is the [...]

Read the rest of this entry >>

php
9,548 spam comments
blocked by
Akismet