Search code examples
phpparametersopensearch

Getting the {searchTerms} on the receiving end of OpenSearch?


I have implemented OpenSearch on a website, but the idea is to receive the resulting parameter and then use it to forward to another service. Something like:

  • My opensearch.xml has the URL such as mywebsite/search&q={searchTerms}
  • When I reach mywebsite/search, I need to verify if "q" exists and proceed

I'm trying to print all $_GET and $_POST variables, and "q" is nowhere to be seen.

How can I test if {searchTerms} exists?


Solution

  • mywebsite/search&q={searchTerms}
    

    the url should be

    mywebsite/search?q={searchTerms}
    

    or you are not sending valid query parameters then q should be accessible in $_GET['q']