We need to fix the title from the rss feed
$year_value) {
$year = substr($year_value, 1, 4); //set the last (YEAR) to $year
}
//print_r($year);
$index = count($result); // gets the index of the single returned value
$title3 = explode("(", $t); // parse movie title from review string
//print_r($title3);
if ($index > 0) {// check index and do stuff based on it
$title = urlencode($title3[0]); //use the first element to be title
$url_omdbapi = 'http://www.omdbapi.com/?t=';
$url = $url_omdbapi.$title.'&y='.$year.'&plot=short&r=json&apikey=1cdf8d38';
//echo " ";
$movie = omdbapi($url);
if (is_object($movie)){
$return_obj = "From omdbapi: ".$movie->Year." | ".$movie->Rated." | ".$movie->Genre." | ".$movie->Plot."
";
//print_r($movie);
}
//print_r($url);
}
return $return_obj;
}
echo "Case1
";
$title="A.I. Rising (2018)";
print "title= ".$title."
";
$return = fixTitle($title);
if(isset($return)) {
echo $return;
}
echo "Case2
";
$title="Avengers: Endgame - SPOILER Talk";
print "title= ".$title."
";
$return = fixTitle($title);
if(isset($return)) {
echo $return;
}
echo "Case3
";
$title="Avengers: Endgame - Spoiler FREE Review";
print "title= ".$title."
";
$return = fixTitle($title);
if(isset($return)) {
echo $return;
}
?>