Search parser
Posted: Tue Jan 21, 2003 9:55 pm
I've been working on a little snippet to work in conjunction with my referral script. I've been trying to determine the easiest method to parsing search engine urls from primarily Google, but in the future I may need to it to work with Yahoo or other search engines.
I need to take something similar to this:
"http://www.google.com/search?hl=en&lr=& ... =jon+kriek"
And turn it into this:
"Google Search: Jon Kriek"
I thought of using eregi_replace() to narrow the search url down to "Google Search", but is it possible to pull the search terms or key works "Jon Kriek" from the search url using eregi_replace() or would something like split() work better? Since search engines use "+" for spacing.
Example: $search=split(' ',$sterms);
I need to take something similar to this:
"http://www.google.com/search?hl=en&lr=& ... =jon+kriek"
And turn it into this:
"Google Search: Jon Kriek"
I thought of using eregi_replace() to narrow the search url down to "Google Search", but is it possible to pull the search terms or key works "Jon Kriek" from the search url using eregi_replace() or would something like split() work better? Since search engines use "+" for spacing.
Example: $search=split(' ',$sterms);