$user = "luxtravelitaly.com";
$language = "Italiano";
$category = "News";
$usepage = 1; // O = No; 1 = Si;
$page = 10;
$stylenews = "testo"; // opzionale
$styletitle = "titolo"; // opzionale
if ((isset($user) && isset($category) && isset($language))) {
$base_link = "http://webservices.interline.it/webservices/services/news/access_services/";
if (!isset($is_included))
$is_included=1;
$link = sprintf("%s%s/viewlistnews?is_included=%s&category=%s&lang=%s",$base_link,$user,$is_included,$category,$language);
if (isset($stylenews))
$link .= "&stylenews=$stylenews";
if (isset($page))
$link .= "&page=$page";
if (isset($usepage) && $usepage)
$link .= "&usepage=$usepage";
if (isset($size))
$link .= "&size=$size";
if (isset($styletitle))
$link .= "&styletitle=$styletitle";
$query_start = $_GET[query_start];
if (isset($query_start))
$link .= "&query_start=$query_start";
$link .= "&query_url=$SCRIPT_NAME";
//Vecchio codice
//include $link;
//-------------------------------------------------------------------------------------------
//Estrazione di tutti gli
dal risultato fornitomi dalla pagina remota che apro con
//un normale fopen leggendo un buffer di 1024 caratteri per volta.
//-------------------------------------------------------------------------------------------
$file = fopen ($link, "r");
if (!$file)
{
echo "Unable to open remote file => $link.\n";
exit;
}
$line = '';
while (!feof ($file))
{
$line .= fgets ($file, 1024);;
}
fclose($file);
//I link della tabella
preg_match_all("/(.*)<\/a>/",$line,$test);
//Il navigatore
preg_match_all("/(.*)<\/a>/",$line,$nav);
//I link dei popup
preg_match_all("/window.open\(\'(.*)\'\,/",$line,$val_pop);
$url_popup=array();
//memorizzo ogni url popup in un vettore, pulendolo
foreach($val_pop[0] as $d)
$url_popup[] = str_replace("','detail',","",str_replace("window.open('","",$d));
//Navigo ogni popup salvando il contenuto in un stringa enorme
$sum_popup_page = '';
foreach($url_popup as $p_url)
{
$line = "";
$file = fopen ($p_url, "r");
if (!$file)
{
echo "Unable to open remote file => $p_url.\n";
exit;
}
$line = '';
while (!feof ($file))
{
$line .= fgets ($file, 1024);;
}
fclose($file);
$sum_popup_page .= $line;
}
//echo "$sum_popup_page";
//die;
//preg_match_all('/
[a-zA-Z0-9\s\<\/\>\xe8\xf2\xec\xe0\xf9\x3d\x21^.\+\-\*"\'\?\$%&\(\)\[\]\{\}\@\#,;:]*<\/td>/',$sum_popup_page,$body__);
preg_match_all('/ | [a-zA-Z0-9\s,^.<\/>\xf2\xec\xe0\xf9\x3d\x21\xe8\x3f!,:;\(\)\[\]\{\}\-\+\*&%^$\^\'\xa3]*<\/td>/',$sum_popup_page,$body__);
//Sostituisco tutti i link delle news con la sintassi corretta per la visualizzazione del popup
$__final = array();
for($i = 0; $i < count($test[3]);$i++)
{
$title_popups[] = $test[3][$i];
$body_popups = $body__[0][$i];
//$body_popups = str_replace("\n","",$body_popups);
$body_popups = str_replace(" ","",$body_popups);
$body_popups = str_replace(' | ',"",$body_popups);
$body_popups = str_replace(" | ","",$body_popups);
$body_popups = "
".$title_popups[$i]."";
$__final[] = $body_popups;
/*
$body_popups = preg_replace('/\<[a-zA-Z0-9\s\/\n]*\>/i', '',$body_popups);
$body_popups = str_replace("\n","",$body_popups);
$body_popups = str_replace("","",str_replace('
',"",$body_popups));
$__final[] = "".$title_popups[$i]."";
*/
}
//print_r($__final);
// Stampa della tabella
echo "";
foreach($__final as $tab)
{
echo "$tab | ";
}
// /* foreach($nav[0] as $n)
// echo "$n | "; navigatore*/
echo " ";
//-------------------------------------------------------------------------------------------
}
else
{
echo "Modulo news non configurato correttamente: manca un paramento essenziale user, language, category!";
}
?>
|