Autore Topic: feed rss website x5 php  (Letto 1350 volte)

Rino

  • Nuovo arrivato
  • *
  • Post: 3
feed rss website x5 php
« il: 01 Marzo, 2017, 19:42:10 »
Salve
sto cercando di implementare del codice personalizzato per gestire i feed direttamente dal sito poiché quello di default del programma mi stà stretto potrei utilizzare la funzione php ► time(); per generare la data ma vorrei rimanere attinente all ' orientamento che segue website affidandosi alla funzione :-


/**
 * Get the most recent date in the provided array of PHP times that do not define a future time.
 * The date is provided in the RSS format Sun, 15 Jun 2008 21:15:07 GMT
 * @param  array    $timeArr
 * @return string
 */


function getLastAvailableDate($timeArr) {
    if (count($timeArr) > 0) {
        sort($timeArr, SORT_DESC);
        $utcTime = time() + date("Z", time());
        foreach ($timeArr as $time) {
            if ($time <= $utcTime) {
                return date("r", $time);
            }
        }
    }
    return date("r", time());}

Ho fatto vari tentativi ma mi ritorna sempre un errore
sicuramente sbaglio il passaggio dell argomento $timeArr
che "formato deve avere l'array" io ho utilizzato quello che genera website ad es.

echo getLastAvailableDate(array(1488390480));
ma ho un errore di questo tipo
Warning:  date() expects parameter 2 to be long, string given in  ► return date("r", $time);

Qualcuno ha provato a lavorare su questa funzione ? grazie

Rino

  • Nuovo arrivato
  • *
  • Post: 3
Re:feed rss website x5 php
« Risposta #1 il: 01 Marzo, 2017, 19:44:57 »
o trattasi di un avviso trascurabile?

Rino

  • Nuovo arrivato
  • *
  • Post: 3
Re:feed rss website x5 php
« Risposta #2 il: 01 Marzo, 2017, 20:00:11 »
Apparte lo warning che spero qualcuno riesce a motivarmi quello che mi chiedo


/* codice recuperato dal file x5feedready.php */
<lastBuildDate><?php echo getLastAvailableDate(array(1488394140)); ?></lastBuildDate>

è dove viene generato il 1488394140 ? sicuramente da una funzione tipo time();
che non sono riuscito a recuperare spulciando nei file di website
lo chiedo perchè ho fatto delle prove ed il codice che ritorna a me la funzione time(); riporta sempre le ultime tre cifre differenti dal risultato presente
[/size]echo getLastAvailableDate(array(1488394140); e quindi mi chiedo magari ci sarà un operazione di sottrazione da qualche parte anche se non mi spiego il perchè....
saluti