Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Long URLs with more than 4095 characters in php

$url = "http://example.com/............."

The $url has about more than 4095 characters . I need to access this URL in php, but if I use file or file_get_contents, it returns an error

How can i open or access this URL in php?

like image 872
haitao Avatar asked Jun 10 '11 09:06

haitao


People also ask

How do you fix a URL that is too long?

How To Fix. There are several things that you can do to avoid URLs that are too long: If using dynamic URLs with URL parameters, use server-side URL rewrites to convert them into static, human-readable URLs. Try to minimize the number of parameters in the URL whenever possible.

Is there a character limit on URLs?

The maximum length of a URL in the address bar is 2048 characters. However, the successful processing of extra-long links by the browser doesn't mean that a search robot will be able to process them too. The appropriate page URL is 75 characters long.

How do I find the URL length?

A URL length checker is a tool that allows you to view the number of characters in a URL. By doing this, you can see whether it meets the URL length limit of search engines and make necessary changes for better website optimization. Most search engines allow a max URL text length of 2,000-2,500 characters.


1 Answers

Your problem isn't PHP, it's the madness of your requirement. :) Also ;

What is the maximum length of a URL in different browsers?

Surely you want POST instead of crazy GET. This sounds more like a fundamental problem of the systems design.

like image 150
AlexanderJohannesen Avatar answered Sep 27 '22 17:09

AlexanderJohannesen