Hi Guys and Girls,
I am having some fun with some Spanish text. I have tried converting it to html entities and replacing the funky letters.
No joy.
Ayuda por favor!
$feed_url = 'http://www.infojobs.net/trabajos.rss/kw_english/';
$xml = simplexml_load_file($feed_url);
foreach($xml->channel->item as $item)
{
$job_title = htmlentities($item->title);
$job_link = htmlentities($item->link);
$job_description = htmlentities($item->description);
$job_pubDate = htmlentities($item->pubDate);
$search = array('á','ñ','ó');
$replace = array('a','n','o');
$job_title = str_replace($search, $replace, $job_title);
$job_description = str_replace($search, $replace, $job_description);
echo "<p>$job_title <br/> $job_link <br/>$job_description <br/>$job_pubDate <br/></p>";
// check to see if it is already in the DB
$query = "SELECT FROM job where job_link = '$job_link' AND job_pubDate = '$job_pubDate'";
echo "$query <br/>";
$result = mysql_query($query);
$rows = mysql_num_rows($result);
if($rows >1) {
echo "<h1>Job is already in the Database</h1>";
}
else {
echo "Adding job $job_title<br>";
$insert = "INSERT into job (job_title, job_link, job_description, job_pubDate) values('$job_title','$job_link','$job_description','$job_pubDate')";
echo "$insert <br/>";
mysql_query($insert);
}
}