I can easily encode and decode the URL when the actual string is not transfer through the POST or GET url only work with static string passed in the function.
I need to send some encoded string with some static information like
http://somedomain.com/testfolder/test.php?tracking_url='someotherdomain.com?id=10&test_id=50'&click_id=60
i use the following code like as below
<?php
class test{
public static function simple_encrypt($text)
{
$salt ='whatever_you_want';
return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
}
public static function simple_decrypt($text)
{
$salt ='whatever_you_want';
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
}
}
echo $test =test::simple_encrypt("http://somedomain.com/testfolder/test.php?tracking_url='someotherdomain.com?id=10&test_id=50'&click_id=60");
echo "<br/>";
echo test::simple_decrypt($test);
?>
the above code is working perfect if i pass the encoded string as a static
like
echo test::simple_decrypt($test);
i got the the sting back :
http://somedomain.com/testfolder/test.php?tracking_url='someotherdomain.com?id=10&test_id=50'&click_id=60
but i need to get the encoded string through the url than i need to fetch the tracking_url and encoded string.
thanks