decode url with php

how can I decode following query string with php?

t=%B1Z%2B%26k%C9%BF%B1%3Fh%3Fd%3F%9F%2Fa%90%3Ft%C5%8B%A0%3F-%F9s%D5d+%E2sJ-B%9DE%D0T%FA%A4.%93%AF%A05%98d%F9%85%CC%22H%3Fd%F9%9D%C3%22hE%8B%C1%D65%3F%A8%3A%25%24&charset=ISO-8859-1

I've already tried urldecode but I get following output

t=±Z+&kÉ¿±?h?d?Ÿ/a?tÅ‹ ?-ùsÕd âsJ-BEÐTú¤.“¯ 5˜dù…Ì"H?dùÃ"hE‹ÁÖ5?¨:%$&charset=ISO-8859-1

I've tried many ways but couldn't decode it

thanks in advance

Answers


Use parse_str to "decode" and parse your string, as in the example snippet further down in this post.

Read more about the function in php.net's manual:


$data = "t=%B1Z%2B%26k%C9%BF%B1%3Fh%3Fd%3F%9F%2Fa%90%3Ft%C5%8B%A0%3F-%F9s%D5d+%E2sJ-B%9DE%D0T%FA%A4.%93%AF%A05%98d%F9%85%CC%22H%3Fd%F9%9D%C3%22hE%8B%C1%D65%3F%A8%3A%25%24&charset=ISO-8859-1";

parse_str ($data, $out);
print_r   ($out);

Array
(
    [t] => ±Z+&kÉ¿±?h?d?/a?tÅ ?-ùsÕd âsJ-BEÐTú¤.¯ 5dùÌ\"H?dùÃ\"hEÁÖ5?¨:%$
    [charset] => ISO-8859-1
)

Read about urlencode and urldecode here

$output = urldecode($encoded);

Use urldecode!

$decoded = urldecode(substr($queryString,3));

maybe this one might help:

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

output will be : http://sample.com


Need Your Help

Problem to insert into mysql table

php mysql insert

I have made a script to send messages. But the problem is it fails to insert into table when i type a bit longer message though i have set "mail" as VARCHAR and length 30005 .

Is a parse tree the same thing as bytecode?

perl

What exactly is the difference between bytecode and a parse tree, specifically the one used by Perl? Do they actually refer to the same concept, or is there a distinction?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.