Pagina 1 di 1

PHP Curl script mi aiutate a capire come si usa?

Inviato: 14/02/2013, 20:59
da Gelmo88
ciao a tutti.. ho trovato questo script che dovrebbe aprire una determinata pagina ogni tot secondi!?

Codice: Seleziona tutto

<?php
set_time_limit (20);
 
function utime () {
    $time = explode( " ", microtime());
    $usec = (double)$time[0];
    $sec = (double)$time[1];
    return $sec + $usec;
}
 
$start = utime();
 
$count = 0;
$number = 60;
 
while ( $count < $number) {
    $curl = curl_init ();
 
##################################
##     Your Site Goes Here      ##
##################################
    curl_setopt ($curl, CURLOPT_URL, "xxxxx site xxxx" );
    curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1 );
    $siteName = curl_exec ($curl);
 
 
 
 
 
 
 
    curl_close ($curl);
    echo $siteName;
 
    $count++;
}
echo $count;
 
#################################################################

 
//Put this at the end of page
 
$end = utime();
$run = $end - $start;
echo " <br> Page created in: " .
        substr($run, 0, 10) . " seconds.";
?>
<br>
solo che se lo faccio partire mi esce questo errore.

Codice: Seleziona tutto

Destination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbiddenDestination host forbidden60 
Page created in: 0.30160999 seconds.

Re: PHP Curl script mi aiutate a capire come si usa?

Inviato: 14/02/2013, 21:17
da Tiger
la variabile "$culrl" (indirizzo sito) e' stata valorizzata?

Codice: Seleziona tutto

curl_setopt ($curl, CURLOPT_URL, "xxxxx site xxxx" );
xxxxx site xxxx

Re: PHP Curl script mi aiutate a capire come si usa?

Inviato: 15/02/2013, 14:32
da Gelmo88
per il il test.. ho utilizzato questo pagina qui:

Codice: Seleziona tutto

http://agconsulting.altervista.org/PVB/pvb.html
dove ho messo un contatore visite... ma l'errore permane..

con il sospetto che fosse perché è sullo stesso server.. e quindi potrebbe essere che non lo può fare.. ho provato a mettere una pagina esterna ma anche quella mi da questo errore..

Re: PHP Curl script mi aiutate a capire come si usa?

Inviato: 18/02/2013, 14:08
da Carlo
Se il tuo host è Altervista, probabilmente non hai sbloccato le connessioni verso server esterni dal pannello che ti viene messo a disposizione.