Beispiel #1
0
function get_rss_news($feed_url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $feed_url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5000);
    $data = curl_exec($ch);
    curl_close($ch);
    //define class
    $pxml = new ParseXML();
    //parse xml array data
    $xml_array = $pxml->GetXMLTree($data);
    //define variable for array data
    $array_news = $xml_array;
    return $array_news;
}
function parseXML($data, $lastDownloadSeason = NULL, $lastDownloadEpisode = NULL)
{
    $ParseXML = new ParseXML();
    //Init the ParseXML class
    $xmlarray = $ParseXML->GetXMLTree($data);
    //Parse the XML passed through to $data
    $result = false;
    $xmlURL = $xmlarray['RSS'][0]['CHANNEL'][0]['LINK'][0]['VALUE'];
    //Get the URL from the RSS file
    $parsedURL = parse_url($xmlURL);
    parse_str($parsedURL['query'], $parsedQuery);
    $showName = $parsedQuery['show_name'];
    $epguide = fetchURLContents("http://epguides.com/" . str_replace(" ", "", $showName) . "/");
    $epguide = explode("\n", $epguide);
    $itemsInFeed = count($xmlarray['RSS'][0]['CHANNEL'][0]['ITEM']);
    $entryNumber = 0;
    $endwhile = true;
    while ($entryNumber < $itemsInFeed && $endwhile) {
        $url = $xmlarray['RSS'][0]['CHANNEL'][0]['ITEM'][$entryNumber]['ENCLOSURE'][0]['ATTRIBUTES']['URL'];
        $pubDate = $xmlarray['RSS'][0]['CHANNEL'][0]['ITEM'][$entryNumber]['PUBDATE'][0]['VALUE'];
        $description = explode(';', $xmlarray['RSS'][0]['CHANNEL'][0]['ITEM'][$entryNumber]['DESCRIPTION'][0]['VALUE']);
        $showTitle = explode(': ', $description[1]);
        $showTitle = $showTitle[1];
        $season = explode(': ', $description[2]);
        $season = $season[1];
        if (!isset($lastDownloadSeason) || !is_numeric($lastDownloadSeason) || !is_numeric($lastDownloadEpisode)) {
            $lastDownloadSeason = $season;
            $lastDownloadEpisode = "00";
        }
        $episode = explode(': ', $description[3]);
        $episode = $episode[1];
        if (strlen($episode) < 2) {
            $episodeSpaced = " " . $episode;
        } else {
            $episodeSpaced = $episode;
        }
        if ($showTitle === NULL || ($showTitle = "n/a")) {
            $showTitle = array_keys(preg_grep("/{$season}-{$episodeSpaced}/i", $epguide));
            $showTitle = $epguide[$showTitle[0]];
            $showTitle = explode(">", $showTitle);
            $showTitle = explode("<", $showTitle[1]);
            $showTitle = $showTitle[0];
        }
        $seasonPadded = $season;
        $episodePadded = $episode;
        if (strlen($season) < 2) {
            $seasonPadded = "0" . $season;
        }
        if (strlen($episode) < 2) {
            $episodePadded = "0" . $episode;
        }
        if ($seasonPadded <= $lastDownloadSeason && $episodePadded <= $lastDownloadEpisode) {
            $endwhile = false;
        }
        if ($season == $lastDownloadSeason && $endwhile == true) {
            $result[$entryNumber]['url'] = $url;
            $result[$entryNumber]['showName'] = $showName;
            $result[$entryNumber]['season'] = $season;
            $result[$entryNumber]['episode'] = $episode;
            if (strlen($season) < 2) {
                $result[$entryNumber]['season'] = "0" . $season;
            }
            if (strlen($episode) < 2) {
                $result[$entryNumber]['episode'] = "0" . $episode;
            }
            $result[$entryNumber]['showTitle'] = $showTitle;
        }
        //echo $showName." - ".$season.$episode." - ".$showTitle."\n";
        $entryNumber++;
    }
    //print_r($xmlarray);
    return $result;
}
Beispiel #3
0
<?php

$Result = @fopen($CallingHome['ServerURL'] . "?do=GetReflectorList", "r");
if (!$Result) {
    die("HEUTE GIBTS KEIN BROT");
}
$INPUT = "";
while (!feof($Result)) {
    $INPUT .= fgets($Result, 1024);
}
fclose($Result);
$XML = new ParseXML();
$Reflectorlist = $XML->GetElement($INPUT, "reflectorlist");
$Reflectors = $XML->GetAllElements($Reflectorlist, "reflector");
?>


<table class="listingtable">
 <tr>   
   <th width="40">#</th>
   <th width="75">Reflector</th>
   <th width="120">Country</th>
   <th width="90">Service</th>
   <th width="400">Comment</th>
 </tr>
<?php 
$odd = "";
for ($i = 0; $i < count($Reflectors); $i++) {
    $NAME = $XML->GetElement($Reflectors[$i], "name");
    $COUNTRY = $XML->GetElement($Reflectors[$i], "country");
    $LASTCONTACT = $XML->GetElement($Reflectors[$i], "lastcontact");
Beispiel #4
0
<?
require_once('includes/config.php');
$ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'http://www.viethconsulting.com/members/mem_xml/'.$org_id.'_business_cats.xml');
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1) ;
            $data = array('org_code' => $org_id,
            'username' => $username,
            'password' => $password
            );
        $data = curl_exec($ch);
        curl_close($ch);  
        //define class 
        $pxml = new ParseXML;
        //parse xml array data
        $xml_array = $pxml->GetXMLTree($data);
        //define variable for array data
        $array_new=$xml_array;
?>
Beispiel #5
0
 public function LoadXML()
 {
     if ($this->XMLFile != null) {
         $handle = fopen($this->XMLFile, 'r');
         $this->XMLContent = fread($handle, filesize($this->XMLFile));
         fclose($handle);
         $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "<XLX") + 4, 3);
         if (!is_numeric($this->ServiceName)) {
             $this->ServiceName = null;
             return false;
         }
         $this->ReflectorName = "XLX" . $this->ServiceName;
         $LinkedPeersName = "XLX" . $this->ServiceName . "  linked peers";
         $LinkedNodesName = "XLX" . $this->ServiceName . "  linked nodes";
         $LinkedUsersName = "XLX" . $this->ServiceName . "  heard users";
         $XML = new ParseXML();
         $AllNodesString = $XML->GetElement($this->XMLContent, $LinkedNodesName);
         $tmpNodes = $XML->GetAllElements($AllNodesString, "NODE");
         for ($i = 0; $i < count($tmpNodes); $i++) {
             $Node = new Node($XML->GetElement($tmpNodes[$i], 'Callsign'), $XML->GetElement($tmpNodes[$i], 'IP'), $XML->GetElement($tmpNodes[$i], 'LinkedModule'), $XML->GetElement($tmpNodes[$i], 'Protocol'), $XML->GetElement($tmpNodes[$i], 'ConnectTime'), $XML->GetElement($tmpNodes[$i], 'LastHeardTime'));
             $this->AddNode($Node);
         }
         $AllStationsString = $XML->GetElement($this->XMLContent, $LinkedUsersName);
         $tmpStations = $XML->GetAllElements($AllStationsString, "STATION");
         for ($i = 0; $i < count($tmpStations); $i++) {
             $Station = new Station($XML->GetElement($tmpStations[$i], 'Callsign'), $XML->GetElement($tmpStations[$i], 'Via node'), $XML->GetElement($tmpStations[$i], 'Via peer'), $XML->GetElement($tmpStations[$i], 'LastHeardTime'));
             $this->AddStation($Station, false);
         }
         $AllPeersString = $XML->GetElement($this->XMLContent, $LinkedPeersName);
         $tmpPeers = $XML->GetAllElements($AllPeersString, "PEER");
         for ($i = 0; $i < count($tmpPeers); $i++) {
             $Peer = new Peer($XML->GetElement($tmpPeers[$i], 'Callsign'), $XML->GetElement($tmpPeers[$i], 'IP'), $XML->GetElement($tmpPeers[$i], 'LinkedModule'), $XML->GetElement($tmpPeers[$i], 'Protocol'), $XML->GetElement($tmpPeers[$i], 'ConnectTime'), $XML->GetElement($tmpPeers[$i], 'LastHeardTime'));
             $this->AddPeer($Peer, false);
         }
         $this->Version = $XML->GetElement($this->XMLContent, "Version");
     }
 }
function parseXML($data)
{
    $ParseXML = new ParseXML();
    $xmlarray = $ParseXML->GetXMLTree($data);
    $latestFile = count($xmlarray['PSYN'][0]['PROJECT'][0]['FILES'][0]['FILE']) - 1;
    $addonName = $xmlarray['PSYN'][0]['PROJECT'][0]['NAME'][0]['VALUE'];
    $addonURL = $xmlarray['PSYN'][0]['PROJECT'][0]['URL'][0]['VALUE'];
    $currentDownloadID = $xmlarray['PSYN'][0]['PROJECT'][0]['FILES'][0]['FILE'][$latestFile]['ATTRIBUTES']['ID'];
    $currentVersion = $xmlarray['PSYN'][0]['PROJECT'][0]['FILES'][0]['FILE'][$latestFile]['NAME'][0]['VALUE'];
    $zipURL = $xmlarray['PSYN'][0]['PROJECT'][0]['FILES'][0]['FILE'][$latestFile]['URL'][0]['VALUE'];
    $result = array($addonName, $addonURL, $currentDownloadID, $currentVersion, $zipURL);
    return $result;
}
Beispiel #7
0
<?php

$Result = @fopen($CallingHome['ServerURL'] . "?do=GetReflectorList", "r");
$INPUT = "";
if ($Result) {
    while (!feof($Result)) {
        $INPUT .= fgets($Result, 1024);
    }
    $XML = new ParseXML();
    $Reflectorlist = $XML->GetElement($INPUT, "reflectorlist");
    $Reflectors = $XML->GetAllElements($Reflectorlist, "reflector");
}
fclose($Result);
?>
<table class="listingtable">
 <tr>
   <th width="25">#</th>
   <th width="100">XLX Peer</th>
   <th width="154">Last Heard</th>
   <th width="156">Linked for</th>
   <th width="90">Protocol</th>
   <th width="67">Module</th><?php 
if ($PageOptions['PeerPage']['IPModus'] != 'HideIP') {
    echo '
   <th width="125">IP</th>';
}
?>
 </tr>
<?php 
$odd = "";
$Reflector->LoadFlags();