Currently Browsing: PHP tutorials

How to detect tablet devices with php

The easy way to detect mobile or tablet devices is using javascript – we know the width and height of the tablet is bigger than the mobile and so the only currently quick solution is to identify the tablet with its width and height. It is highly useful and recommended to detect mobile devices that are larger than smartphones because often it is preferable to render the desktop version of a site rather than the mobile version.
read more

« Previous Entries

How to add Rss to Twitter?

In this post I will tell you how you can add your rss feed to twitter. Are you tired of spending so much time tweeting on Twitter? Spend your valuable time and efforts on managing you business instead of marketing all of the time.
read more

« Previous Entries

Rss feed in twitter

Do you have an rss feed and you don’t know how you can post the items to your twitter account without moving any finger ? You can use BNC Automatic Rss to Twitter – the easiest way to get your message across on Twitter.
read more

« Previous Entries

Passing JavaScript to a PHP script

Simple code that will help you to pass javascript to a php variable.
read more

« Previous Entries

Fatal error: Call to undefined function: curl_init()

When you try to use cURL to open a file and you got that error “Fatal error: Call to undefined function: curl_init()” you must enabled cURL function from your php configuration php.ini
read more

« Previous Entries

How to Get the Current Page URL

Here is a php little function  that will help you to get the current page url function CurrentPageURL() { $pageURL = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; $pageURL .= $_SERVER['SERVER_PORT'] != '80' ? $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"] : $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; return $pageURL; }
read more

« Previous Entries

PHP : How to get the select values from a Drop Down list

This is the scenario <select name="cars"> <option value="volvo">Volvo</option> <option value="audi">Audi</option> <option value="toyota">Toyota</option> <option value="form">Ford</option> </select> This php code – get all everything between <select> preg_match('/<select name="foo">(.*)<\/select>/msU',$html,$matches); print_r($matches);
read more

« Previous Entries

How To Force File Download With PHP

Here is a a simple code that will force the browser to download a file
read more

« Previous Entries

Simple PHP BBCode

Many websites allow visitors to contribute to the sites’s content through forums, blogs etc . When you’re building such sites, it’s a good idea to provide users with the ability to enhance that content by posting formatted text. Here is a simple example of how to use bbcode with php.
read more

« Previous Entries

Validate username in php

Use this simple code to validate the usernames in php ( maybe you need to a user registration ). The username will have only characters, numbers and _ (underscore)
read more

« Previous Entries