How to get the base url in php

How to get the base url in php

Suppose you have to retrieve the URL of the application in PHP i.e http://example.com Using this piece of code //output : example.com $DOMAIN = $_SERVER['SERVER_NAME']; // output: http:// $protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'https://' : 'http://'; // output : http://example.com $main_url = $protocol.$DOMAIN; When...
How to embed the user address using google map in php

How to embed the user address using google map in php

If you want to display the user's address in google map in their profile’s page. It is very simple follow these procedure. Generally in user registration we store the user information like country, state, city or even taken the address fields. Do you want to display the user's address map on their profile page. You must need the address of the user. This...
How to delete the entire directory with in its files in php

How to delete the entire directory with in its files in php

Generally we use the remove directory rmdir() method. In this case the directory will be removed when it has no files on it. another way is unlink() method. This method can be used for removing the single file from the directory location. How to download the multiple directories as a zip file in PHP If you want to remove the directory and its all...
How to get the user ip address in php

How to get the user ip address in php

In many situations developers want's the user ip address. Those are In user registration time store his/her ip address. In login time also store his/her ip address . In these two factors developer compares the registered ip address and logged ip address. If both are equal no issue when these are not equal then intimate the user "You are logined...
Live html compiler using php and bootstrap

Live html compiler using php and bootstrap

If you want to make the live html compiler similar to the w3schools.com try editor What is live html compiler ? you can see the exact output of the html code before save and run in the browser. This is a simple technique to develop the live html code in the php. Here we are going to use the textarea as a input of the html code and iframe as a output...