Forum Index > Support & Feedback > Querystring variables for search Results
 Reply to topic
Previous :: Next Topic
Author Message
Craig77
Member
Member


Joined: 03 Jun 2013
Posts: 2 | TRs | Pics
Craig77
Member
PostMon Jun 03, 2013 5:31 pm 
I'd like to email a friend the link to a search results page, rather than to just the search page and tell them all the stuff to enter. Is there a way to do this, like with query string variables? TIA Cheers.

Back to top Reply to topic Reply with quote Send private message
SeanSullivan86
Member
Member


Joined: 25 Jul 2009
Posts: 681 | TRs | Pics
Location: Seattle, WA
SeanSullivan86
Member
PostTue Jun 04, 2013 12:13 am 
As you probably noticed, the search parameters don't get embedded in the URL. This is because the search request is an HTTP POST request. In Google Chrome, for example, you can inspect the data in the HTTP POST by opening the Developer Tools (Ctrl+Shift+J) and going to the Network tab. With that network tab open, submit a search request and you'll see the data sent to the server. I did a quick search and found these parameters: and_keywords:shuksan+baker search_keywords: or_keywords: not_keywords: search_author: search_forum:-1 search_time:0 search_fields:all search_cat:-1 sort_by:0 sort_dir:DESC show_results:topics return_chars:-1 So the next step is to hope that the page will accept the same arguments as querystring arguments in a GET request. This works on some websites but not others, depending on the implementation of the server side code. So craft a URL using the parameters above. For example: https://www.nwhikers.net/forums/search.php?and_keywords=shuksan+baker&show_results=topics And it does happen to work for this website (probably for all phpBB sites). If you don't know what values to use for the parameters, like what to use for "search_forum", then again use the Network tab of the Develope Tools feature in Chrome. Make the search request you're interested in and then find out what the values were for all the parameters.

Back to top Reply to topic Reply with quote Send private message
Tom
Admin



Joined: 15 Dec 2001
Posts: 17835 | TRs | Pics
Tom
Admin
PostTue Jun 04, 2013 1:03 am 
Unfortunately phpbb2 is a bit sloppy with query string GET requests and doesn't trap all variables like it does for POST requests. I modified the code a while back to trap more of them, but might not have caught them all: and_keywords: find all of these words or "exact phrases" or_keywords: find any of these words (not recommended) not_keywords: exclude results with these words search_author: find posts by this user search_forum: forum # (defualt is all forums) search_time: # days (not recommended) search_fields: all (title and post is default), titleonly, or msgonly sort_by: 0 (Post Time is default), 1 (Post Subject), 2 (Topic Title), 3 (Author), 4 (Forum) sort_dir: ASC, DESC (default) show_results: topics, posts (default) return_chars: max # of characters to display when show_results=posts (default is all characters)

Back to top Reply to topic Reply with quote Send private message
Craig77
Member
Member


Joined: 03 Jun 2013
Posts: 2 | TRs | Pics
Craig77
Member
PostTue Jun 04, 2013 9:38 am 
Awesome, thanks Sean & Tom, that totally worked!!

Back to top Reply to topic Reply with quote Send private message
   All times are GMT - 8 Hours
 Reply to topic
Forum Index > Support & Feedback > Querystring variables for search Results
  Happy Birthday speyguy, Bandanabraids!
Jump to:   
Search this topic:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum