i saw some things look a like but not the same, i hope you can assist:
i am trying to execute the first result from youtube search results by
parse youtube search result page and find this: (belong to the first video)
<img alt="Thumbnail" src="http://i4.ytimg.com/vi/kUJLn7645Zs/default.jpg">
then i want to get the video code which is this: (kUJLn7645Zs)
this is my code and something doesn't work, please assist
$res = file_get_contents("http://www.youtube.com/results?search_query=take+me");
preg_match_all('/<img\s[a-zA-Z0-9=\'\":\/.()_@&\s]*>/',$res,$matches);
$str = $matches[0][0];
$tempArray = array();
$tempArray = explode('/',$str);
echo $tempArray[count($tempArray) - 2];
preg_match_all()if you only want the first result?