strange character

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>';

}
}
}






?> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux