

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get parameters from a URL string in PHP?
To get parameters from a URL string in PHP, the code is as follows−
Example
<?php $url = 'http://www.example.com/register?name=demo&email=example12@domain.com'; $res = parse_url($url); parse_str($res['query'], $params); echo 'Email = '.$params['email']; ?>
Output
This will produce the following output−
Email = example12@domain.com
Example
Let us now see another example −
<?php $url = 'http://www.example.com/register?name=demo&email=example12@domain.com'; $res = parse_url($url); parse_str($res['query'], $params); echo 'Email = '.$params['name']; ?>
Output
This will produce the following output−
Email = demo
- Related Questions & Answers
- JavaScript - know the value of GET parameters from URL
- Node.js – Reading Path Parameters from URL
- How to get a bitmap from Url in Android app?
- Get Last Part of URL in PHP?
- How to read request parameters passed in URL using JSP?
- How to pass reference parameters PHP?
- PHP Context Parameters
- Extract hostname from URL string in JavaScript?
- How to get a variable name as a string in PHP?
- How to correctly get a value from a JSON PHP?
- How to get file name from a path in PHP?
- URL Decoding in PHP
- How to get current URL in JavaScript?
- How to get current URL in jQuery?
- How to URL encode a string (NSString) in iPhone?
Advertisements