Tag Archives: HTTP

Use Multiple Headers in a PHP


With PHP, you can send multiple HTTP headers with file_get_contents() . you can also send information such as HTTP_ACCEPT, HTTP_ACCEPT_LANGUAGE, and HTTP_CONNECTION with file_get_contents(). In this post, I have write a complete example code to set multiple headers; an Authorization header and a Content-Type header using PHP and make POST request using file_get_contents(). <?php $options = [“http” => [ “method” => “POST”, “header” => [“Authorization: token ” . $access_token, “Content-Type: application/json”], “content” => $data ]]; $context = stream_context_create($options); ?> Now […]

Php Interview Questions and Answers – Part 1


1- What’s PHP ? The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications. 2- What Is a Session? A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. There is only one session object available to your PHP scripts at any time. Data saved to the session by […]

Top Checks For Securing PHP


Obviously, PHP+ MySQL + Apache is a popular web technology.Its components are powerful, versatile and Free. However, the default settings ship with PHP is not suitable for production sites. Here, it is a check list of settings that are intended to harden the default PHP installation. 1) Disable Remote URLs for File Handling Functions File handling function like fopen, contents which accepts URLs as file parameters (for example: fopen(‘http://www.yoursite.info’,’r’)).These function facilitate the ease of development on accessing remote resources; however, […]

Redirect 301 in PHP and .htaccess

Redirect 301 in PHP and .htaccess

What is 301 redirect ? You have a website and its all pages are ranked in the search engine. And now you’ve moved these files to a new domain. What will happen in this scenario!!. You are sending the visitor to “Error 404 – File not found” page when they follow your website in the search engine. Furthermore, if you place the custom error page, then also you will be keep loosing ranking in upcoming days in search engines as […]

Redirect PHP To Another Page

Redirect PHP To Another Page

With PHP it is possible to redirect to another page using the header() network function. The header() function is used to send a raw HTTP header why it can easily be used transfer a user to a new page without clicking on a link. If you are not familiar with the header() function you need to be aware that just like in any other web programming language it is required to write the headers before the actual page content is […]