0

Could I avoid the limitation of 2000 characters in GET URL data append? Could anyone help me? I want to append PHP array in URL. Code is as below:

$url = array(
   ['ABC'] => 10,
   ['XYZ'] => 20
)
<a href="abc.php?order_number=' . $order_number . '&v=' . time() . '&arr=' . urlencode(serialize($url)) . " target="_blank"></a>

Here I use an array of count 2. If I will use an array of count 30-40. Will it be affected to the limitation of GET url?

Bhavin Patel
  • 121
  • 2
  • 6

1 Answers1

0

Here you can read about current limitations in different browsers: What is the maximum length of a URL in different browsers?

And I bet there is no workaround about this. Consider using POST instead. Of course if you need browser support. If not http itself don't provide any limitation on url length.

Instead you can use something like this with jQuery:

<script language="javascript"> 

   function SendPostRequest(){
      $.post("yourPage.php", { key: "Value", AnotherKey: "Another Value" } ); 
   }

</script>


<a href="javascript:SendPostRequest()">Send Request</a> 

You also can do it in plain javascript without using any libraries.

Volod
  • 1,283
  • 2
  • 15
  • 34