Converting space and slash into commas from URL variable and making a valid next URL
<?php
// For an current page/URL is: http://mysite.com/currency-pair-detail?fullname=US Dollar / Indonesian Rupiah FX Spot Rate
// Feed URL logic, first check from url keywords, then check url from shortcode else set default one.
if (isset($_REQUEST['fullname']) && $_REQUEST['fullname']!="") {
// create a feed url by finding keywords from current url (fullname variable)
$headlines_keywords = $_REQUEST['fullname'];
$headlines_keywords = strstr($headlines_keywords, 'FX Spot Rate', true);
$headlines_keywords = str_replace(" / ",",", $headlines_keywords);
$headlines_keywords = str_replace(" ","%2B", $headlines_keywords);
$feed_url = "http://headlines.com/?keywords=$headlines_keywords&firstRow=0&numRows=6";
} else if ($feed_url==""){
$feed_url = "http://headlines.com/API/?keywords=a,the,up,down,first,last,now&firstRow=0&numRows=6";
}
?>