I have a video script to pull youtube videos. The script is very basic and allows any word search's. I want to include a bannedword part to stop any searches for the obvious unwanted words that are on some youtube videos. Presumably a $bannedwords array in the main config file. Can anyone help with whats needed to the script. $keyword is the subject of the search, ie $keyword = golf Heres the part of the script that needs modding. <? function YT_ListByTag($keyword, $page=1) { global $config; $keyword = urlencode($keyword); $start_index = ($page - 1) * $config['list_per_page'] + 1; $req = "http://gdata.youtube.com/feeds/videos?vq={$keyword}". "&start-index={$start_index}". "&max-results={$config['list_per_page']}". "&orderby=updated"; if($config['xml_cache_enable']) { $data[1] = YT_GetXMLRespCache($req); } else { $data[1] = REST_Request($req); } $data[0] = Xml2Array($data[1]); return $data; } Any help welcome. Thanks Terry PROBLEM SOLVED ################## Thanks Stoli Your code worked great. Terry
function YT_ListByTag($keyword, $page=1) { global $config; $bannedwords = array("banned", "words", "here"); if (in_array($keyword, $bannedwords)) { // keyword is banned return; } $keyword = urlencode($keyword); $start_index = ($page - 1) * $config['list_per_page'] + 1; $req = "http://gdata.youtube.com/feeds/videos?vq={$keyword}". "&start-index={$start_index}". "&max-results={$config['list_per_page']}". "&orderby=updated"; if($config['xml_cache_enable']) { $data[1] = YT_GetXMLRespCache($req); } else { $data[1] = REST_Request($req); } $data[0] = Xml2Array($data[1]); return $data; } PHP: