How to decode the url in php where url is encoded with encodeURIComponent

0 votes
I have tried the urldecode() but then also I don't have the url which I have encoded.

How to decode the url in php where url is encoded with encodeURIComponent()?
Jul 7, 2020 in Java-Script by kartik
• 37,510 points
3,873 views

1 answer to this question.

0 votes

Hello @kartik,

Use this function:

<?php
$string = 'http%3A%2F%2Fexample.com';
$output = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($string)); 
echo html_entity_decode($output,null,'UTF-8');
?>

Output will be :

http://example.com
answered Jul 7, 2020 by Niroj
• 82,880 points

Related Questions In Java-Script

0 votes
1 answer

How to get the current URL with JavaScript?

Hello @kartik, Use: window.location.href As noted in the comments, ...READ MORE

answered Aug 28, 2020 in Java-Script by Niroj
• 82,880 points
958 views
0 votes
1 answer

How to get the URL without any parameters in JavaScript?

Hello @kartik, This is possible, but you'll have ...READ MORE

answered Oct 9, 2020 in Java-Script by Niroj
• 82,880 points
5,363 views
0 votes
1 answer

How to access PHP session variables from jQuery function in a .js file?

Hello, You can produce the javascript file via ...READ MORE

answered Apr 29, 2020 in Java-Script by Niroj
• 82,880 points
12,234 views
0 votes
1 answer

How to change url after success in ajax without page reload?

Hello @kartik, Use the browser history to change ...READ MORE

answered Apr 29, 2020 in Java-Script by Niroj
• 82,880 points
9,309 views
0 votes
1 answer

How can we Create Multiple Where Clause Query Using Laravel Eloquent?

Hii, You can use Conditions using Array: $users = User::where([ ...READ MORE

answered Mar 30, 2020 in Laravel by Niroj
• 82,880 points
16,178 views
0 votes
1 answer

How to send email using php?

Hello @kartik 1.) Download PHPMailer, open the zip file ...READ MORE

answered Apr 1, 2020 in PHP by Niroj
• 82,880 points
1,020 views
0 votes
1 answer

Where to register Facades & Service Providers in Lumen?

Hello, To register a facade with an alias, ...READ MORE

answered Apr 6, 2020 in Laravel by Niroj
• 82,880 points
4,078 views
0 votes
1 answer

How can I update NodeJS and NPM to the next versions?

Hello @kartik, First check your NPM version npm -v 1).Update ...READ MORE

answered May 5, 2020 in Java-Script by Niroj
• 82,880 points
759 views
0 votes
1 answer

How to get the browser to navigate to URL in JavaScript?

Hii, This works in all browsers: window.location.href = '...'; If ...READ MORE

answered May 28, 2020 in Java-Script by Niroj
• 82,880 points
2,376 views
0 votes
1 answer

How to Store PHP variable with HTML in JavaScript in Laravel Blade Template?

Hello @kartik, The double curly brackets {{ }} will always ...READ MORE

answered Jun 11, 2020 in Java-Script by Niroj
• 82,880 points
16,608 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP