List/Grid

Tag Archives: php

Connecting PHP to Microsoft SQL Server on Debian/Ubuntu

1. Install FreeTDS and the PHP MS SQL extension sudo apt-get install freetds-common freetds-bin unixodbc php5-sybase Note: That is correct – the MS SQL extension is in the “php5-sybase” package…. Read more »

Display recent Twitter tweets using PHP

Display recent Twitter tweets using PHP

Here is a code to display recent twitter tweets using PHP: $doc = new DOMDocument(); # load the RSS document, edit this line to include your username or user id… Read more »

Convert an HTML table to CSV using PHP

Convert an HTML table to CSV using PHP

Here is a tutorial to convert a HTML table to CSV using php. To do this, we will need two php files: 1. table.php (where you create your table) 2…. Read more »

How to Send Email from a PHP Script Using SMTP Authentication?

How to Send Email from a PHP Script Using SMTP Authentication?

To send email using a remote mail client in PHP with SMTP authentication, here is the code: <?php require_once “Mail.php”; $from = “Sender Name <sender@example.com>”; $to = “Recipient Name <recipient@example.com>”;… Read more »

Send an Email with PDF Attachment – PHP

Send an Email with PDF Attachment – PHP

To send pdf with your email in PHP, here is what you need to do: I am using php mail function to do that $fileatt = “./yourpdf.pdf”; // Path to… Read more »

Redirect iPhone users using PHP

To detect and redirect your iPhone users on the server-side. Here is a PHP code to redirect iPhone users: // Redirect iPhone/iPod visitors if(strpos($_SERVER['HTTP_USER_AGENT'], ‘iPhone’) || strpos($_SERVER['HTTP_USER_AGENT'], ‘iPod’)){ header(“Location: http://your_mobile_website.com”);… Read more »

Post array of multiple checkbox values in php

If you wish to have multiple checkbox in your page and want retrieve all values of checkbox clicked, then you should use array checkbox name. So now your checkbox values… Read more »

Drupal: Write & Execute PHP code

To write and execute PHP code in your articles or pages in Drupal, go to modules section and enable “PHP filter“: Click on “Save Configurations” Then click on “Add Content”… Read more »

Count number of childnodes in a XML – PHP

I am using “simplexml_load_file” to load my xml file in this case. So lets say my xml file is: <people> <person> <children> child 1 </children> <children> child 2 </children> <children>… Read more »