Created
March 15, 2018 10:14
-
-
Save JRMorris77/d75b6729b2cbf0faefd152b12f1a9a8e to your computer and use it in GitHub Desktop.
Remove invalid line breaks and returns from invalid source XML feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Script Name: getcleanfeed | |
Plugin URI: https://premium.wpmudev.org/ | |
Description: Removes invalid line breaks and returns from source feed | |
Author: James Morris @ WPMUDEV | |
Author URI: https://premium.wpmudev.org/ | |
License: GPLv2 or later | |
*/ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://sourcesite.com/feed/"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$output = curl_exec($ch); | |
curl_close($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