Search code examples
phparraysjsonget

How to make secure data transfer using PHP GET method


In my application I have used GET method to send data over URL in many places. I think it is a not secure way to send data over the URL. Just the data are showing in URL.

Ex:

<a href="check_appointments.php?user=<?php echo $_GET['userid'] ?>&p_id=<?php echo $_GET['pid'] ?>">  </a>

I want to transfer data in secure way. Is there any way to hide these information or any encryption method to follow. Please someone help me to improve my codes. Any help may highly appreciated.


Solution

  • You can encode your data by base64_encode method. It will be encrypted when sending via url. base64_decode to see the decrypted data.

    <a href="check_appointments.php?user=<?php echo base64_encode($_GET['userid']) ?>&p_id=<?php echo base64_encode($_GET['pid']) ?>">  </a>