Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remove invalid line breaks and returns from invalid source XML feed
Script Name: getcleanfeed
Plugin URI:
Description: Removes invalid line breaks and returns from source feed
Author: James Morris @ WPMUDEV
Author URI:
License: GPLv2 or later
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
$string = str_replace(array("\r", "\n", "\r\n"), ' ', $output);
echo file_put_contents("outputfeed.xml", $string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.