strange character
| From: | hadi | Date: | Mon, 23 Feb 2015 20:13:28 +0000 |
| Subject: | strange character | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324510@lists.php.net to get a copy of this message | ||
Im downloading feed from the internet. Im getting strange character (–) im
not able to get rid of it.
I tried to use preg_replace(). But not helping
Here is my code
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
require 'database.php';
$url = "http://www.sahafah.net/rss.php";
$rss = file_get_contents($url);
ini_set('mbstring.substitute_character', "none");
$rss= mb_convert_encoding($rss, 'UTF-8', 'UTF-8');
$rss = simplexml_load_string($rss);
if($rss)
{
$items = $rss->channel->item;
foreach($items as $item)
{
$title = $item->title;
$link = $item->link;
$published_on = $item->pubDate;
$description = $item->description;
$category = $item->category;
$guid = $item->guid;
$pattern = "<";
$posfrist = strpos($item->description, $pattern);
if($posfrist !== false)
{
preg_match('/.*</',$item->description,$match);
$match1 = str_replace("<","",$match);
echo '<pre>';print_r($match1);echo '</pre>';
$string2 = $item->description;
preg_match('/http.*.jpg/',$string2,$match2);
echo '<pre>';print_r($match2);echo '</pre>';
}
}
}
?>