Using the function below you would be able to get the HTML code of any webpage. function display_sourcecode($url) { $lines = file($url); $output = “”; foreach ($lines as $line_num => $line) { // loop thru each line and prepend line numbers $output.= “Line #<b>{$line_num}</b> : ” . htmlspecialchars($line) . “<br>\n”; …
Read More »DETECT LOCATION OF THE USER
Using the below function you can check the city from which the user is visiting your website. function detect_city($ip) { $default = ‘UNKNOWN’; $curlopt_useragent = ‘Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)’; $url = ‘http://ipinfodb.com/ip_locator.php?ip=’ . urlencode($ip); $ch = curl_init(); $curl_opt = array( CURLOPT_FOLLOWLOCATION …
Read More »SENDING EMAIL WITH MANDRILL
Mandrill is a powerful SMTP provider. Developers tend to use a third party SMTP provider for better inbox deliveries. For the below function you would have to put a file “Mandrill.php” in the same folder as the PHP file you would be using to send emails. function send_email($to_email,$subject,$message1) { require_once ‘Mandrill.php’; $apikey …
Read More »How to send sms using php ?
While working on web or mobile applications, you often face a situation where you need to send an SMS to your user either for login purposes or providing them with some information. The below PHP function would help you with it. For sending SMS using any language, you’d need an …
Read More »What is the difference between include(), include_once() and require_once() ?
The include() statement includes and evaluates a specified line i.e. it will include a file based in the given path. require() does the same thing expect upon failure it will generate a fatal error and halt the script whereas include() will just gives a warning and allow script to continue. …
Read More »How can create connection with database usin php ?
First of all we need a connection with database. after this we can modify and access the data from the database.
Read More »How to upload file on server using php ?
We can easily upload a file or image on the server using this php code. Before upload an image or file we should configure php.ini file. In your “php.ini” file, search the file_uploads directive, and change it to On: file_uploads = On
Read More »How can start session in php ?
A session in php is started using session_start() function. Globle variables (eg. $_SESSION.) are used for session variables. Now we create a page “example_session.php” and start a session with some session variables :
Read More »You Should Already Know before learn PHP
Before you continue you should have a basic understanding of the following: HTML CSS JavaScript What is PHP? PHP is an acronym for “PHP: Hypertext Preprocessor” PHP scripts are executed on the server PHP is free to download and use PHP is a widely-used, open source scripting language What Can …
Read More »Start learning PHP with Tutorial Desk
PHP is a good language for developing website.It is easy to use. Basic example code og PHP. Example: <!DOCTYPE html> <html> <body> <?php echo “My first PHP script!”; ?> </body> </html>
Read More »