GetNews v0_3RC2: closer to the final version
Translation of the original in Catalan. Read it in: CatalàCastellano
After a few hours improving little things from the previous version and adding a new feature I now have the new version of getnews.
The big novelty in this version is that now before trying to grab an RDF file from some site it checks whether that site is online. In addition to the 5min backup system that was already there in the previous version, which didn't grab the news if it hadn't been more than 5min since they had been grabbed.
So then, there's now another parameter more to call getnews, whether or not it has to check the host before grabbing the news. The check is done by means of a ping and that's why it's been set up so it can be activated and deactivated because if there are hosts that don't return ping it would never grab the news from there.
Tb a little design thing has been modified now it no longer returns the output directly on screen but rather does it to an array therefore, if we now want to show the output we have to directly do an echo before the call of the function, a call to the function is no longer enough.
These are the most significant changes of version 0.3RC2, I hope that soon I'll verify it works well and I can bring out version 1.00.
This tb I hope will speed up a lot the access speed to the portal, which many times because of the news never finished loading any more.
1 comment
Comments from the old blog, as they were written. Comments are closed.
Oriol Rius
Gran millora en el codi, fins ara s'agafaben les URL amb la comanda fopen, a
partir d'ara tot el procés el fa el getnews. Obra el socket i fa la
connexió ell:
$host = next(parse_url($urlsite)); // Extrec el host de la url
$path_url = end(parse_url($urlsite)); //path de la url
$fp = fsockopen ("$host",80, &$errno, &$errstr,30); // connecto al
host
if (!$fp) {
return "ERROR: site/page not avaiable
n";
} else {
fputs ($fp,"GET ".$path_url." HTTP/1.1n");
fputs ($fp,"Host: $hostnn");
while (!feof($fp)) {
$buffer=$buffer.fgets($fp,128);
}
$line = explode ("n",$buffer);
fclose($fp);
}