Problema visualizzazione codice sorgente altro sito

marsentry

Nuovo Utente
28 Mar 2013
5
0
0
Salve ragazzi e complimenti per questo bellissimo sito!!:fonzie:

Come da titolo ho un problema nel visualizzare il codice sorgente di un sito mediante php.

Allora, la pagina è questa:

http://www.scorespro.com/soccer/matchcenter/siena-vs-cagliari/17-03-2013/

Questa pagina visualizza i dati di una partita di calcio.

Ora io in php faccio:

PHP:
$pagina=nl2br(htmlentities(file_get_contents('http://www.scorespro.com/soccer/matchcenter/siena-vs-cagliari/17-03-2013/')));
echo $pagina;

Ma quello che mi esce non è tutto il codice html che il mio browser visualizza ( e che riesco a vedere con firebug), bensì è quanto vi riporto alla fine del post, dove ci sono varie funzioni javascript. Quello che vorrei salvare nella mia variabile è effettivamente quello che viene visualizzato dal browser, coi dati della partita. Qualcuno può aiutarmi?

Ecco il codice che mi stampa php:


HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>AC milan vs Palermo - 17 Mar 2013: Live Match Centre and Livescore</title>
<meta name="description" content="AC milan vs Palermo - 17 Mar 2013 Live Match Centre with LineUps, Formations, Scorers, Cards and Livescore by ScoresPro.com"/>
<meta name="keywords" content="AC milan, Palermo, 17 Mar 2013, AC milan vs Palermo, AC milan vs Palermo 17 Mar 2013, lineups, substitutions, cards, goal, goals, yellow cards, red cards, scorer, scorers, formations, venue, coach, stats, player, player names, match centre "/>
<meta name="RESOURCE-TYPE" content="DOCUMENT" />
<meta name="DISTRIBUTION" content="GLOBAL" />
<meta name="AUTHOR" content="ScoresPro.com" />
<meta name="COPYRIGHT" content="Copyright (c) 2006 - 2013 ScoresPro Ltd." />
<meta name="ROBOTS" content="INDEX,FOLLOW" />
<meta name="REVISIT-AFTER" content="1 DAYS" />
<meta name="RATING" content="GENERAL" />
<script type="text/javascript">
var livescoresPath = '/soccer';
</script>
<script type="text/javascript" src='http://code.jquery.com/jquery-1.4.3.min.js'></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.min.js"></script>
<link href="http://cdn.scorespro.com/style/template3col_final.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.scorespro.com/style/matchcenter.css" rel="stylesheet" type="text/css" />
</head><body>
<div id="livecard">
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1836678-1']);
_gaq.push(['_setDomainName', 'scorespro.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript">
function update_mc(){
$.ajax({
url:"/soccer/ajax-matchcenter.php?link=ac-milan-vs-palermo/17-03-2013&" + Math.random(),
success: function(xml_content) {
$("#livecard").html(xml_content);
cron_timer();
}
});
setTimeout("update_mc2()", 30000);
}
function update_mc2(){
$.ajax({
url:"/soccer/ajax-matchcenter.php?link=ac-milan-vs-palermo/17-03-2013&" + Math.random(),
success: function(xml_content) {
$("#livecard").html(xml_content);
master_counter = 0;
}
});
setTimeout("update_mc2()", 30000);
}
update_mc();
var master_counter = 0;
function cron_timer(){
if ($("#statustype879559-1").val() == "live"){
master_counter++;
calc_time();
setTimeout("cron_timer()", 990);
}
}
function calc_time(){
var time_str = '';
var secs = 0;
var mins = 0;
var counterA = Math.round($("#m-counter879559-1").val() - $("#counter879559-1").val()) + master_counter;
if ($("#status879559-1").val() == "1 HF"){
if ( counterA <= 60){
time_str = '01:00';
} else if(counterA > 2700 ){
time_str = '45:00+';
} else {
secs = counterA % 60;
if(secs < 10){
secs = "0" + secs;
}
mins = (counterA - secs )/60;
time_str = mins + ":" + secs;
}
time_str = ' - ' + time_str;
} else if ($("#status879559-1").val() == "2 HF"){
if ( counterA <= 0){
time_str = '46:00';
} else if(counterA > 6300 ){
time_str = '90:00+';
} else {
counterA = counterA - 900;
secs = counterA % 60;
if(secs < 10){
secs = "0" + secs;
}
mins = (counterA - secs )/60;
time_str = mins + ":" + secs;
}
time_str = ' - ' + time_str;
} else if ($("#status879559-1").val() == "E/T"){
if ( counterA <= 7260){
time_str = '91:00';
} else if(counterA > 8400 ){
time_str = '120:00+';
} else {
counterA = counterA - 1200;
secs = counterA % 60;
if(secs < 10){
secs = "0" + secs;
}
mins = (counterA - secs )/60;
time_str = mins + ":" + secs;
}
time_str = ' - ' + time_str;
} else {
time_str = '';
}
$(".event-status-879559-1").html(time_str);
}
$(document).tooltip();
</script>
</body>
</html>
 
Ultima modifica di un moderatore:
Semplice la pagina remota contiene quello di base, penso che il resto dell'html sia generato successivamente tramite javascript, infatti se provi a disattivarlo dal browser(il js) vedi che ci sarà solo una pagina grigia, puoi risolvere tramite ajax (da php non credo perché sfrutta librerie che fanno richieste dirette tramite http, quindi senza procedere col rendering del client)
 
Ragazzi, innanzitutto grazie per le risposte.

Guardando le vostre risposte, sia quella di IImanuII (soprattutto il link sull Web Scraping), sia quella di Nefyt, mi sono fatto un'idea che va usato qualcosa tipo AJAX.

Infatti quelle righe di codice javascript ora le vedo come semplice testo, dovrei eseguirle in qualche modo per vedere il contenuto definitivo.

Devo veder eun po' come fare....

Se qualcuno l'ha già fatto questo lavoro si accettano volentieri consigli :mavieni:
 

Discussioni simili

M
Risposte
2
Visite
2K
HTML e CSS
Membro cancellato 26246
M