1

Here is the background of a product architecture i'm working on.

I am working on product where front-end is in PHP and back-end is in JAVA. JAVA works as a service and PHP uses curl library to call java services.

I'm using GET Request to call java services.

It was working perfectly, but i faced an issue when URL is too long (in my case URL is almost 2,00,000 characters long).

i searched about curl and i found that there is no limit for url length in curl.

also when curl is executed i checked curl error number curl_errno() and it returned 0. curl Returns the error number or 0 (zero) if no error occurred.

so i can't figure out what can be the issue, also it is issue at JAVA side or PHP side ? also how can i increase GET request size limit ?

Paresh Balar
  • 338
  • 2
  • 10

1 Answers1

1

The Java application server (or any intermediate entity that processes the request, like a firewall) may limit the url size. So, try to pass data on the body of the request, not on the url.

Andres
  • 10,561
  • 4
  • 45
  • 63
  • i cant.. :( Product code is so much complex. i cant change it to POST request now. i have to use GET request only. – Paresh Balar Jan 09 '14 at 20:46
  • The configuration of the max url length depends on the server/firewall/etc you use. But two million characters seems too long, anyway. – Andres Jan 09 '14 at 20:48
  • compress your data?, seems like switching to post would be much easier – cmorrissey Jan 09 '14 at 20:51
  • @ChristopherMorrissey : compress url data in GET request ? how ? – Paresh Balar Jan 09 '14 at 20:56
  • @Andres: in my case do i have to change the configuration of JAVA server as curl showing no error ? – Paresh Balar Jan 09 '14 at 20:58
  • URL size isn't limited only by webserver configuration. Browsers also limit that value. Check this link: http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers – victorantunes Jan 09 '14 at 21:01
  • `$compressed = gzcompress('Compress me', 9);` then add it to your GET values, you obviously will need to uncompress it in your other app – cmorrissey Jan 09 '14 at 21:02
  • @PareshBalar Yes, here you can learn how to do it on Tomcat: http://serverfault.com/questions/56691/whats-the-maximum-url-length-in-tomcat – Andres Jan 09 '14 at 21:07
  • @victorantunes He's using curl, so the browser probably's not the problem. – Andres Jan 09 '14 at 21:09
  • @victorantunes: i'm not using browser as its curl library. browser limit wont be issue in my case. – Paresh Balar Jan 09 '14 at 21:09
  • @Andres : thanx.. i think this will solve my problem.. will try this. hope this will solve my problem.. :) – Paresh Balar Jan 09 '14 at 21:11