Eric Malalel
Eric Malalel

Reputation: 345

how to prevent php function file_get_contents to truncate my request

I use file_get_contents to send a request to a web service, let say: https://example.com/mywebservice?arg1=value1&arg2=value2

If value2 is avaluewith#sometextafter, I send: https://example.com/mywebservice?arg1=value1&arg2=avaluewith#sometextafter

My problem is that when the web server processes the request, it gets arg2=avaluewith

The pound character and what is after is lost.

How to correct that?

Upvotes: 0

Views: 337

Answers (2)

Eric Malalel
Eric Malalel

Reputation: 345

I added urlencode() to the param which was truncated and it works fine.

Now the full URL with full params is received and processed by the web service.

Upvotes: 0

ceejayoz
ceejayoz

Reputation: 180004

THe URL's hash is never sent to the webserver. It exists solely client-side.

Upvotes: 1

Related Questions