cURL offers an option to add the URL-fragment?

871 Views Asked by At

There are an option -d to append data as parameters at URL of GET, so I'm imagining that exists also an option to add the URL fragment (# "URL hash").

PS: no clues by curl --help | grep -i frag.

1

There are 1 best solutions below

0
On

Nope. Fragments are ignored by the server - they are for the browser only.

When you look for "http://somesite.com/1?myvar=4#myresource" - the server can see the somesite.com, the "1" (path variable), the myvar (query string), any posted data but sadly not the fragment. When the client (browser) gets the server result back, it applies the fragment then client side to "flick" to the bookmark or for javascript to make a request.

Getting hash parameters from request url