Search code examples
curlrequestwgetinsomnia

Insomnia : generated code doesn't return the same result as insomnia


The issue happens when searching on https://forum.mobilism.org

An account is needed, so I created one and then created a request in insomnia to login on this url : https://forum.mobilism.org/ucp.php?mode=login

The cookies are then stored by insomnia, and I created a request to search with a keyword on this url : https://forum.mobilism.org/search.php?sr=topics&sf=titleonly&keywords=test

This request works fine and returns the search results as it would in a web browser.

But then when generating a get or curl request, the page returned doesn't contain the results and asks to login (although the cookies are in the request).

I don't see what the difference is in between the insomnia request and the one with curl or wget.


Solution

  • This request works fine and returns the search results as it would in a web browser.

    But then when generating a get or curl request, the page returned doesn't contain the results and asks to login (although the cookies are in the request).

    Generally User-Agent request header is used by browser or other software to identify itself. wget option for setting is

    --user-agent=agent-string

    Identify as agent-string to the HTTP server.(...)

    Please try specifying same User-Agent as your browser is using and check if it would help.