
- PHP - Home
- PHP - Roadmap
- PHP - Introduction
- PHP - Installation
- PHP - History
- PHP - Features
- PHP - Syntax
- PHP - Hello World
- PHP - Comments
- PHP - Variables
- PHP - Echo/Print
- PHP - var_dump
- PHP - $ and $$ Variables
- PHP - Constants
- PHP - Magic Constants
- PHP - Data Types
- PHP - Type Casting
- PHP - Type Juggling
- PHP - Strings
- PHP - Boolean
- PHP - Integers
- PHP - Files & I/O
- PHP - Maths Functions
- PHP - Heredoc & Nowdoc
- PHP - Compound Types
- PHP - File Include
- PHP - Date & Time
- PHP - Scalar Type Declarations
- PHP - Return Type Declarations
- PHP - Operators
- PHP - Arithmetic Operators
- PHP - Comparison Operators
- PHP - Logical Operators
- PHP - Assignment Operators
- PHP - String Operators
- PHP - Array Operators
- PHP - Conditional Operators
- PHP - Spread Operator
- PHP - Null Coalescing Operator
- PHP - Spaceship Operator
- PHP Control Statements
- PHP - Decision Making
- PHP - If…Else Statement
- PHP - Switch Statement
- PHP - Loop Types
- PHP - For Loop
- PHP - Foreach Loop
- PHP - While Loop
- PHP - Do…While Loop
- PHP - Break Statement
- PHP - Continue Statement
- PHP Arrays
- PHP - Arrays
- PHP - Indexed Array
- PHP - Associative Array
- PHP - Multidimensional Array
- PHP - Array Functions
- PHP - Constant Arrays
- PHP Functions
- PHP - Functions
- PHP - Function Parameters
- PHP - Call by value
- PHP - Call by Reference
- PHP - Default Arguments
- PHP - Named Arguments
- PHP - Variable Arguments
- PHP - Returning Values
- PHP - Passing Functions
- PHP - Recursive Functions
- PHP - Type Hints
- PHP - Variable Scope
- PHP - Strict Typing
- PHP - Anonymous Functions
- PHP - Arrow Functions
- PHP - Variable Functions
- PHP - Local Variables
- PHP - Global Variables
- PHP Superglobals
- PHP - Superglobals
- PHP - $GLOBALS
- PHP - $_SERVER
- PHP - $_REQUEST
- PHP - $_POST
- PHP - $_GET
- PHP - $_FILES
- PHP - $_ENV
- PHP - $_COOKIE
- PHP - $_SESSION
- PHP File Handling
- PHP - File Handling
- PHP - Open File
- PHP - Read File
- PHP - Write File
- PHP - File Existence
- PHP - Download File
- PHP - Copy File
- PHP - Append File
- PHP - Delete File
- PHP - Handle CSV File
- PHP - File Permissions
- PHP - Create Directory
- PHP - Listing Files
- Object Oriented PHP
- PHP - Object Oriented Programming
- PHP - Classes and Objects
- PHP - Constructor and Destructor
- PHP - Access Modifiers
- PHP - Inheritance
- PHP - Class Constants
- PHP - Abstract Classes
- PHP - Interfaces
- PHP - Traits
- PHP - Static Methods
- PHP - Static Properties
- PHP - Namespaces
- PHP - Object Iteration
- PHP - Encapsulation
- PHP - Final Keyword
- PHP - Overloading
- PHP - Cloning Objects
- PHP - Anonymous Classes
- PHP Web Development
- PHP - Web Concepts
- PHP - Form Handling
- PHP - Form Validation
- PHP - Form Email/URL
- PHP - Complete Form
- PHP - File Inclusion
- PHP - GET & POST
- PHP - File Uploading
- PHP - Cookies
- PHP - Sessions
- PHP - Session Options
- PHP - Sending Emails
- PHP - Sanitize Input
- PHP - Post-Redirect-Get (PRG)
- PHP - Flash Messages
- PHP AJAX
- PHP - AJAX Introduction
- PHP - AJAX Search
- PHP - AJAX XML Parser
- PHP - AJAX Auto Complete Search
- PHP - AJAX RSS Feed Example
- PHP XML
- PHP - XML Introduction
- PHP - Simple XML Parser
- PHP - SAX Parser Example
- PHP - DOM Parser Example
- PHP Login Example
- PHP - Login Example
- PHP - Facebook Login
- PHP - Paypal Integration
- PHP - MySQL Login
- PHP Advanced
- PHP - MySQL
- PHP.INI File Configuration
- PHP - Array Destructuring
- PHP - Coding Standard
- PHP - Regular Expression
- PHP - Error Handling
- PHP - Try…Catch
- PHP - Bugs Debugging
- PHP - For C Developers
- PHP - For PERL Developers
- PHP - Frameworks
- PHP - Core PHP vs Frame Works
- PHP - Design Patterns
- PHP - Filters
- PHP - JSON
- PHP - Exceptions
- PHP - Special Types
- PHP - Hashing
- PHP - Encryption
- PHP - is_null() Function
- PHP - System Calls
- PHP - HTTP Authentication
- PHP - Swapping Variables
- PHP - Closure::call()
- PHP - Filtered unserialize()
- PHP - IntlChar
- PHP - CSPRNG
- PHP - Expectations
- PHP - Use Statement
- PHP - Integer Division
- PHP - Deprecated Features
- PHP - Removed Extensions & SAPIs
- PHP - PEAR
- PHP - CSRF
- PHP - FastCGI Process
- PHP - PDO Extension
- PHP - Built-In Functions
PHP - URL Functions
PHP has a number of built-in functions for handling URLs. These programs can be used for encoding, decoding, parsing, and URL creation, with other functions.
These methods are useful when working with URLs in PHP because they improve the process of manipulating and extracting data from URLs.
Installation
Since PHP URL functions are built into the PHP core, no further installation is required. All you need to do is make sure PHP is installed on your server or in your development environment.
Requirements
These functions are supported by all versions of PHP. Make that the specific function you want to use is supported by the version of PHP you are using. Normally, the URL functions are supported by PHP 4 and later.
Runtime Configuration
There are no extra runtime changes needed while using PHP URL functions. They are ready to use. But make sure your PHP environment is configured properly in order to create websites. You can look at your php.ini file to see the standard PHP settings.
Predefined Constants
The constants listed below are defined by this extension and will only be available once it has been compiled into PHP or dynamically loaded at runtime.
The following constants are intended to be used with parse_url() −
Sr.No | Constant & Description |
---|---|
1 |
PHP_URL_SCHEME (int) Outputs the scheme (protocol) of the URL parsed. |
2 |
PHP_URL_HOST (int) Outputs the hostname of the URL parsed. |
3 |
PHP_URL_PORT (int) Outputs the port of the URL parsed. |
4 |
PHP_URL_USER (int) Outputs the user of the URL parsed. |
5 |
PHP_URL_PASS (int) Outputs the password of the URL parsed. |
6 |
PHP_URL_PATH (int) Outputs the path of the URL parsed. |
7 |
PHP_URL_QUERY (int) Outputs the query string of the URL parsed. |
8 |
PHP_URL_FRAGMENT (int) Outputs the fragment (string after the hashmark #) of the URL parsed. |
9 |
PHP_QUERY_RFC1738 (int) Encoding is performed per RFC 1738 and the application/x-www-form-urlencoded media type, which implies that spaces are encoded as plus (+) signs. |
10 |
PHP_QUERY_RFC3986 (int) Encoding is performed according to RFC 3986, and spaces will be percent encoded (%20). |
List of Functions
Here is the list of some common PHP URL functions −
Sr.No | Function & Description |
---|---|
1 |
This function can decode the data encoded with MIME base64. |
2 |
This function can encode the data with MIME base64. |
3 |
This function can fetch all headers sent by the server in response to an HTTP request. |
4 |
This function can extract all meta tag content attributes from a file and can return an array. |
5 |
This function can generate a URL-encoded query string. |
6 |
This function can parse a URL and return its components. |
7 |
This function can decode a URL encoded strings. |
8 |
This function is a URL encode according to RFC 3986. |
9 |
This function can decode a URL encoded string. |
10 |
This function is a URL-encodes string. |