too long

I am passing the following data through url :

<?php    
   $url = "generate_pdf.php/?feed=" . urlencode(serialize($result));    
   echo '<div id="left-sidebar">';
   echo '<a href="' . $url . '"><div id="pdf">Download PDF</div></a>';
   echo '</div>';
?>

Here the $result containing the rss feed data in form of array. I am using urlencode(serialize($result) for passing that data through url and its working perfectly on local machine but in server it showing the following error :

Request-URI Too Large
The requested URL's length exceeds the capacity limit for this server.

Please tell me your views to deal with this problem.

I made this mistake (It was more than not knowing than making a mistake!) once. I've build an ajax engine for webapps. It used only the get method. Once I had a form with a lot of data and it did not work.

After some research I found out this: look here

So basically most browser does not make any problems because they support approximately 100.000 characters. But most web-servers like Apache only support 4000 characters from a URL.

No you can not just configure Apache to accept more. It is possible do but you have to edit the source code to do so.

solution: Use the POST method it is made for large data transfer between web-servers and clients(which are most likely browsers).

In your case I think you want to create a pdf with some user input an for some reason that input is larger than 4000 characters.

  1. Store data somewhere on the server (e.g. a database)
  2. Assign a unique ID to such data
  3. Pass that ID in the URL
  4. Retrieve data from storage using the ID as key