PHP: If no Results - Split the Searchrequest and Try to find Parts of the Search
- by elmaso
Hello, i want to split the searchrequest into parts, if there's nothing to find.
example: "nelly furtado ft. jimmy jones" - no results - try to find with nelly, furtado, jimmy or jones..
i have an api url.. thats the difficult part.. i show you some of the actually snippets:
$query = urlencode (strip_tags ($_GET[search]));
and
$found = '0';
if ($source == 'all')
{
if (!($res = @get_url ('http://api.example.com/?key=' . $API . '&phrase=' . $query . ' . '&sort=' . $sort)))
{
exit ('<error>Cannot get requested information.</error>');
;
}
how can i put a else request in this snippet, like if nothing found take the first word, or the second word, is this possible? or maybe you can tell me were i can read stuff about this function?
thank you!!