I want to embed rss news on my site so I found a feed aggregator. I inputted the RSS feeds I wanted and it spit this code out for me to paste on my page: <?php $ch = curl_init(); $timeout = 5; // in seconds, you can change this lower if you want curl_setopt ($ch, CURLOPT_URL, 'http://myfeed.com/example.html'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); echo $file_contents; ?> Code (markup): I want to put a nofollow tag to the feeds that will get displayed. What do I have to change in this code?
I'm not looking to pay someone. I'll just put nofollow in a metatag if no one can help but would prefer if it can be done through that specific code.
Would adding something like: str_replace("<a", "<a rel=\"nofollow\"", $file_contents); PHP: It replaces all the instances of <a in the text with <a rel="nofollow"
Thank you wd_2k6, that small piece of code works. I'll leave it here so that people who are looking to put a nofollow tag or another microformat into a php curl script feed can find it on the search engines. Rep +1 <?php $ch = curl_init(); $timeout = 5; // in seconds, you can change this lower if you want curl_setopt ($ch, CURLOPT_URL, 'http://thefeed.com/example.html'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); $file_contents = str_replace("<a", "<a rel=\"nofollow\"", $file_contents); curl_close($ch); echo $file_contents; ?> Code (markup):