GlisWeb framework
_rss.tools.php
Vai alla documentazione di questo file.
1 <?php
2 
22  function rss2array( $url ) {
23 
24  // prelevo il feed URL metodo dati tipo MIME dei dati tipo MIME della risposta
25  $rss = restCall( $url, METHOD_GET, NULL, NULL, MIME_TEXT_PLAIN );
26 
27  // log
28  logWrite( $rss, 'rss', LOG_DEBUG );
29 
30  // parsing
31  $arr = xml2array( $rss );
32 
33  // log
34  logWrite( print_r( $arr, true ), 'rss', LOG_DEBUG );
35 
36  // debug
37  writeToFile( $rss, 'var/log/rss/downloads/' . md5( $url . time() ) . '.xml' );
38 
39  // parsing
40  return $arr;
41 
42  }
43 
44 ?>
rss2array( $url)
Definition: _rss.tools.php:22
logWrite( $m, $f='site', $l=LOG_NOTICE, $d=DIRECTORY_LOG, $t=CURRENT_LOG_LEVEL, $s=SITE_STATUS)
scrive un messaggio nei log del sito
Definition: _log.utils.php:48
restCall( $url, $method=METHOD_GET, $data=NULL, $datatype=MIME_APPLICATION_JSON, $answertype=MIME_APPLICATION_JSON, &$status=NULL, $headers=array(), $user=NULL, $pasw=NULL, &$error=NULL)
esegue una chiamata REST
Definition: _rest.tools.php:23
writeToFile( $t, $f, &$e=NULL)
scrive una stringa su un file
const METHOD_GET
Definition: _config.php:280
xml2array( $contents, $get_attributes=true, $priority='tag')
Definition: _xml.tools.php:130
const MIME_TEXT_PLAIN