PHP URL Functions

Beginner
6 min read
Updated: Nov 2026
10 function guides
Function index

About This Index

This page is the PHP URL Functions index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.

Learn how encoding, query strings and URL parts work on /php/url. Use this page when you need a specific helper such as urlencode(), http_build_query(), or parse_url().

Beginner path.

Start with urlencode() and http_build_query(), then move on to parse_url() and the base64 pair.

How to Call a URL Function

URL helpers are global functions—pass the text or array and use the return value:

PHP
<?php
$value = urlencode("php & mysql");              // php+%26+mysql
$query = http_build_query(["q" => "php"]);      // q=php
$parts = parse_url("https://example.com/a?x=1");
$host  = parse_url("https://example.com/a", PHP_URL_HOST);   // example.com

PHP URL Functions Table

All function guides in this PHP tutorial series (10 tutorials in 3 categories).

Encode & decode

6 functions

Make text safe for a URL, or turn it back into plain text.

FunctionDescriptionTutorial
urlencode()Encodes a string for a URL query, writing spaces as plus signs.Try it
urldecode()Decodes a URL-encoded string and turns plus signs into spaces.Try it
rawurlencode()Encodes a string for use in a URL path using RFC 3986.Try it
rawurldecode()Decodes %XX sequences in a URL without changing plus signs.Try it
base64_encode()Encodes data as a base64 string.Try it
base64_decode()Decodes a base64 string back to the original data.Try it

Build & parse

2 functions

Create a query string from an array, or split a URL into its parts.

FunctionDescriptionTutorial
http_build_query()Builds a URL query string from an array.Try it
parse_url()Splits a URL into its parts such as host, path and query.Try it

Fetch page info

2 functions

Read headers and meta tags from a web page.

FunctionDescriptionTutorial
get_headers()Fetches the response headers a server sends for a URL.Try it
get_meta_tags()Reads the meta tags from a web page or an HTML file.Try it

Frequently Asked Questions

They are the built-in functions that encode, decode, build and read web addresses, plus the base64 pair and two helpers that read page headers and meta tags.
The URL page teaches the ideas and shows short examples. This index lists every function tutorial so you can open urlencode(), parse_url() and the rest.
Start with urlencode() and http_build_query(). They solve the most common problem: putting values safely into a link.
Yes, when you pass a URL. get_meta_tags() can also read a local HTML file.
If you are new, read PHP URL first. Then open urlencode(), http_build_query() and parse_url() from the tables below.

Start with base64_decode()

Open the first guide—syntax, examples, and FAQs.

base64_decode() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

15 people found this page helpful