示例#1
0
 public static function parseConfig($xml)
 {
     $p = new XmlToArray($xml);
     $out = $p->getOutput();
     //first child, not necessarily the config node?
     return $out['config'];
 }
示例#2
0
 public function sendXml($data)
 {
     $responseData = '';
     try {
         $ch = NULL;
         if ($this->test) {
             $ch = curl_init('https://stg.api.payulatam.com/payments-api/4.0/service.cgi');
         } else {
             $ch = curl_init('https://api.payulatam.com/payments-api/4.0/service.cgi');
         }
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         // deshabilitar la validacion SSl (false)
         curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPHEADER => array("Accept:application/xml", "Content-Type:application/xml"), CURLOPT_POSTFIELDS => $data));
         //json_encode($postData)
         $response = curl_exec($ch);
         // enviando datos al servidor de payuLatam
         if ($response === FALSE) {
             //die(curl_error($ch));
             return false;
         }
         //Creating Instance of the Class
         $xmlObj = new XmlToArray($response);
         //Creating Array
         return $arrayData = $xmlObj->createArray();
         //return ($response);//json_decode($response, TRUE); // decodificando el formato Json
     } catch (Exception $ex) {
         return false;
     }
 }
 /**
  * Preparing data and parsing result received
  * 
  * @param array $data
  * @return void
  */
 public function handle($data)
 {
     $this->_request = ArrayToXml::render($data);
     $this->_rawRequest = $this->_request;
     $xmlResponse = self::sendMessage($this->_request);
     if (!in_array($this->getConnection()->getHttpStatusCode(), array('200', '301', '302'))) {
         $this->_response = array('errors' => array('error' => array('code' => array('@data' => $this->getConnection()->getHttpStatusCode()), 'message' => array('@data' => $this->getConnection()->error))));
     } else {
         try {
             $this->_response = XmlToArray::render($xmlResponse);
         } catch (Exception $e) {
             $this->_response = array('errors' => array('error' => array('code' => array('@data' => '0999'), 'message' => array('@data' => $e->getMessage()))));
         }
     }
     $this->_rawResponse = $xmlResponse;
 }
 /**
  * send this message and get response
  * save all warnings - errors are only saved if no payment-url is send from pnag
  *
  * @return SofortLib_TransactionData $this
  */
 public function sendRequest()
 {
     $requestData[$this->_xmlRootTag] = $this->_parameters;
     $requestData = $this->_prepareRootTag($requestData);
     $xmlRequest = ArrayToXml::render($requestData);
     $this->_log($xmlRequest, ' XmlRequest -> ');
     $xmlResponse = $this->_sendMessage($xmlRequest);
     try {
         $this->_response = XmlToArray::render($xmlResponse);
     } catch (Exception $e) {
         $this->_response = array('errors' => array('error' => array('code' => array('@data' => '0999'), 'message' => array('@data' => $e->getMessage()))));
     }
     $this->_log($xmlResponse, ' XmlResponse <- ');
     $this->_handleErrors();
     $this->_parseXml();
     return $this;
 }
 /**
  * Reads the input and tries to read the transaction id
  *
  * @param string $content XML-File Content
  * @return boolean|string (transaction ID, when true)
  */
 public function getNotification($content)
 {
     try {
         $response = XmlToArray::render($content);
     } catch (Exception $e) {
         $this->errors['error']['message'] = 'could not parse message';
         return false;
     }
     if (!isset($response['status_notification'])) {
         return false;
     }
     if (isset($response['status_notification']['transaction']['@data'])) {
         $this->_transactionId = $response['status_notification']['transaction']['@data'];
         if ($response['status_notification']['time']['@data']) {
             $this->_time = $response['status_notification']['time']['@data'];
         }
         return $this->_transactionId;
     } else {
         return false;
     }
 }
 public function testRender()
 {
     $XmlToArray = new XmlToArray($this->_xml, $this->_maxDepth);
     $billcodeArray = array('billcode_request' => array('billcode' => array('@data' => 'test', '@attributes' => array()), '@data' => '', '@attributes' => array()));
     $this->assertEquals($XmlToArray->render($this->_xml), $billcodeArray);
 }
示例#7
0
<html>
   <head>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <meta name="generator" content="PSPad editor, www.pspad.com">
      <title>Hackaton - Cidades das vagas</title>
   </head>
   <body>
      <?php 
$per_page = 500;
$page = $_GET['page'];
if ($page == "") {
    $page = 1;
}
require_once "../extras/xml2array_class.php";
require_once "../extras/basico.php";
$xmlClass = new XmlToArray();
$url = "http://afiliados.catho.com.br/BuscaVagaXML.php?perfil=1&area=47&nivel=4&estado=25&pagina={$page}&total={$per_page}";
//echo $url;
$handleiItems = fopen($url, "r");
$Items = $xmlClass->getXmlData($handleiItems);
$arrayVagas = $xmlClass->createArray($Items);
$total_vagas = $arrayVagas['listing']['totalvagas'];
$completo = $page * $per_page / $total_vagas;
echo number_format($completo * 100, 2) . "%<br>";
if (sizeof($arrayVagas['listing']['vacant']) > 0) {
    foreach ($arrayVagas['listing']['vacant'] as $key => $job) {
        //title
        //date
        //company
        //description
        //branch
示例#8
0
    } else {
        $html = array_map('htmlentities', $_POST);
    }
}
//build the get query for the offers202 restful api
$get = array();
$get['apiKey'] = $_SESSION['user_api_key'];
$get['stats202AppKey'] = $_SESSION['user_stats202_app_key'];
$query = http_build_query($get);
//build the offers202 api string
$url = TRACKING202_API_URL . "/stats202/getPostBacks?{$query}";
#echo "<p>$url</p>";
//grab the url
$data = getUrl($url);
//parse out the array
$xmlToArray = new XmlToArray($data);
$getPostBacks = $xmlToArray->createArray();
template_top('Postback URLs');
include_once '../top.php';
//check for api errors
checkForApiErrors($getPostBacks);
?>


<?php 
if ($_GET['delete']) {
    echo "<div class='success'><div><h3>Your submission was successful</h3>You have deleted a postback url.</div></div>";
}
if ($success) {
    echo "<div class='success'><div><h3>Your submission was successful</h3>You have modified or created a new postback url</div></div>";
}
示例#9
0
        }
        // get our attributes if we have any
        $arAttributes = array();
        if ($oDomNode->hasAttributes()) {
            foreach ($oDomNode->attributes as $sAttrName => $oAttrNode) {
                // retain namespace prefixes
                $arAttributes["@{$oAttrNode->nodeName}"] = $oAttrNode->nodeValue;
            }
        }
        // check for namespace attribute - Namespaces will not show up in the attributes list
        if ($oDomNode instanceof DOMElement && $oDomNode->getAttribute('xmlns')) {
            $arAttributes["@xmlns"] = $oDomNode->getAttribute('xmlns');
        }
        if (count($arAttributes)) {
            if (!is_array($mResult)) {
                $mResult = trim($mResult) ? array($mResult) : array();
            }
            $mResult = array_merge($mResult, $arAttributes);
        }
        $arResult = array($oDomNode->nodeName => $mResult);
        return $arResult;
    }
}
$dom = new XmlToArray();
$dom->load('html.xml');
$html = $dom->readFile();
$html = $html['NotepadPlus']['AutoComplete']['KeyWord'];
$dom->load('javascript.xml');
$js = $dom->readFile();
$js = $js['NotepadPlus']['AutoComplete']['KeyWord'];
$nArray = array_merge($html, $js);
示例#10
0
ini_set("include_path", "{$ORIGPATH}:{$PATH}:{$PATH}/Framework:{$PATH}/Apps");
$TrazaStatus = false;
error_reporting(E_ALL);
require "GlobalSche.php";
$o = newObject("gtasklog");
setlimitRows(150);
$o->searchResults = $o->select("inicio<UNIX_TIMESTAMP(NOW()) AND estado='No Iniciada'");
//print_r($o->searchResults);
/*require_once("Lib/lib_google_translate.php");
  $gt = new Gtranslate;
  $data=$gt->english_to_spanish("hello world");
  $excuses = file($SYS["DOCROOT"]."../Data/excuses.txt");
  $tdata=$gt->english_to_spanish($excuses[rand(0,sizeof($excuses)-1)]);
  */
require_once "Lib/lib_class_xml_to_array.php";
$qod = new XmlToArray(file_get_contents("http://chistes.developers4web.com/rss.php"));
$arr = $qod->createArray();
$chiste = strip_tags(strtr($arr["rss"]["channel"]["item"]["description"], array("/" => "<br>")), "<br><br/><p><div><a>");
$SYS["ROOT"] = "http://172.24.81.200/~operador/globalscheduler/Backend/";
foreach ($o->searchResults as $ID => $GTASK) {
    $g = newObject("group", $GTASK->departamento);
    // Recojer responsables
    foreach ($g->listUsersInGroup() as $user) {
        if (empty($user->email)) {
            continue;
        }
        echo $GTASK->etiqueta . " " . $user->email . "\n";
        require_once "Lib/lib_phpmailer.php";
        $mail = new PHPMailer();
        $mail->AddAddress($user->email);
        $mail->IsHTML(true);
示例#11
0
?>
	 

<?php 
//build the get query for the offers202 restful api
$get = array();
$get['apiKey'] = $_SESSION['user_api_key'];
$get['stats202AppKey'] = $_SESSION['user_stats202_app_key'];
$query = http_build_query($get);
//build the offers202 api string
$url = TRACKING202_API_URL . "/stats202/getStatAccounts?{$query}";
#echo "<p>$url</p>";
//grab the url
$data = getUrl($url);
//parse out the array
$xmlToArray = new XmlToArray($data);
$getStatAccounts = $xmlToArray->createArray();
//check for api errors
checkForApiErrors($getStatAccounts);
?>



<table style="margin: 0px auto;">
	<tr>
		<td style="padding: 0px 0px 20px;">
			<?php 
if ($_GET['delete']) {
    echo "<div class='success'><div><h3>Your submission was successful</h3>You have deleted an account.</div></div>";
}
?>
示例#12
0
    $get['order'] = $_SESSION['stats202_order'];
}
if ($_SESSION['stats202_by']) {
    $get['by'] = $_SESSION['stats202_by'];
}
if (!$_SESSION['stats202_by']) {
    $_SESSION['stats202_by'] = 'DESC';
}
$query = http_build_query($get);
//build the offers202 api string
$url = TRACKING202_API_URL . "/stats202/getSubids?{$query}";
#echo "<p>$url</p>";
//grab the url
$data = getUrl($url);
//parse out the array
$xmlToArray = new XmlToArray($data);
$getSubids = $xmlToArray->createArray();
$getSubids = $getSubids['getSubids'];
echo "subidDate";
echo "\t" . "statAccountNickName";
echo "\t" . "subid";
echo "\t" . "subidActions";
echo "\t" . "subidAmount";
if ($getSubids['subids']) {
    $subids = $getSubids['subids'][0]['subid'];
}
for ($x = 0; $x < count($subids); $x++) {
    if ($subids[$x]['subidActions'] > 0) {
        $subids[$x]['subidActions'] = number_format($subids[$x]['subidActions']);
    } else {
        $subids[$x]['subidActions'] = '-';
示例#13
0
    $get['order'] = $_SESSION['stats202_order'];
}
if ($_SESSION['stats202_by']) {
    $get['by'] = $_SESSION['stats202_by'];
}
if (!$_SESSION['stats202_by']) {
    $_SESSION['stats202_by'] = 'DESC';
}
$query = http_build_query($get);
//build the offers202 api string
$url = TRACKING202_API_URL . "/stats202/getOfferStats?{$query}";
#echo "<p>$url</p>";
//grab the url
$data = getUrl($url);
//parse out the array
$xmlToArray = new XmlToArray($data);
$getOfferStats = $xmlToArray->createArray();
$getOfferStats = $getOfferStats['getOfferStats'];
echo "statAccountNickName";
echo "\t" . "offerName";
echo "\t" . "offerStatImpressions";
echo "\t" . "offerStatClicks";
echo "\t" . "offerStatActions";
echo "\t" . "offerStatEpc";
echo "\t" . "offerStatTotal";
if ($getOfferStats['offerStats']) {
    $offerStats = $getOfferStats['offerStats'][0]['offerStat'];
}
for ($x = 0; $x < count($offerStats); $x++) {
    if ($offerStats[$x]['offerStatClicks'] > 0) {
        $offerStats[$x]['offerStatClicks'] = number_format($offerStats[$x]['offerStatClicks']);
示例#14
0
    $itmhd = '###items###';
}
// echo $encobj->mdecrypt($itmhd);
// echo $itmhd; // exit;
$enc = $_POST['enctyp'];
if ($enc != 'y') {
    $enc = 'n';
}
//$file = SPATH_ROOT."/export_2010-05-07_13_49_54.csv";
//$file = SPATH_ROOT."/export_2010-05-07_13_49_54.xml";
//prints($poOrder);exit;
switch ($type) {
    case ".xml":
        $fileget = file_get_contents($filepath);
        include_once SITE_CLASS_GEN . "class.xml2array.php";
        $xmltoarobj = new XmlToArray($fileget);
        $poOrder = $xmltoarobj->createArray();
        $reqVal = $poOrder['Dataroot']['purchaseorder'];
        // prints($reqVal); exit;
        break;
    case ".csv":
        if (($handle = fopen($filepath, "r")) !== FALSE) {
            $itemstarts = 0;
            $invcode = '';
            $item = 0;
            $itemrow = 0;
            while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                $num = count($data);
                if ($data[0] == '') {
                    $itemstarts = '2';
                }
function convertXmlIntoArray($xml)
{
    $xmlToArray = new XmlToArray($xml);
    $arr = $xmlToArray->createArray();
    return $arr;
}
示例#16
0
 /**
  * Static entry point
  * @param string $input
  * @param bool $simpleStructure (default false)
  * @param int $maxDepth only parse XML to the provided depth (default 20)
  * @throws XmlToArrayException
  * @return array
  */
 public static function render($input, $simpleStructure = false, $maxDepth = 20)
 {
     $Instance = new XmlToArray($input, $maxDepth);
     return $Instance->toArray($simpleStructure);
 }
示例#17
0
$array = XmlToArray::xmlToArray($xml, false, true);
/*
array(
	'data' => array(
		'id' => 1001,
		'info' => null,
		'extra' => array(
			0 => 1111,
			1 => 2222,
			2 => 3333,
		),
	),
)
*/
# Attributes will be omitted, tags will be fulfill role of attributes
$array = XmlToArray::xmlToArray($xml, false, false);
/*
array(
	'data' => array(
		'id' => array(
			'value' => 1001,
		),
		'info' => null,
		'extra' => array(
			0 => array(
				'value' => 1111,
			),
			1 => array(
				'value' => 2222,
			),
			2 => array(
示例#18
0
         $dav->setMethod('PROPPATCH');
         $dav->setPath($dav->path . '/content.txt');
         $dav->body = '<?xml version="1.0"?>
 <d:propertyupdate xmlns:d="DAV:" xmlns:o="urn:schemas-microsoft-com:office:office">
   <d:set>
     <d:prop>
       <o:Author>support_test</o:Author>
     </d:prop>
   </d:set>
 </d:propertyupdate>';
         $dav->addHeader("Content-Type: text/xml; charset=\"utf-8\"");
         $dav->addHeader("Content-Length: " . strlen($dav->body));
         $result = $dav->request();
         $data = substr($result['body'], $n);
         $data = str_replace("D:", "", $data);
         $xmlObj = new XmlToArray($data);
         $arrayData = $xmlObj->createArray();
         $status = $arrayData['multistatus']['response'][0]['propstat'][0]['status'];
         if (strpos($status, 'HTTP/1.1 200') === 0) {
             $cdata['lamp'] = 'green';
         }
         $cdata['text'] = __ShowMessage($mess['PROPPATCH_FILE'], $cdata['lamp']);
         //echo '<div style="padding-left:200px">'.highlight_string($result['body']).'</div>';
         break;
     case 'COPY_FILE':
         $dav->setMethod('COPY');
         $dav->setPath($dav->path . '/content.txt');
         $dav->addHeader('Destination: ' . $path . '/content_copy.txt');
         $result = $dav->request();
         if (strpos($result['headers']['STATUS'], '201 Created')) {
             $cdata['lamp'] = 'green';
示例#19
0
    $get['order'] = $_SESSION['stats202_order'];
}
if ($_SESSION['stats202_by']) {
    $get['by'] = $_SESSION['stats202_by'];
}
if (!$_SESSION['stats202_by']) {
    $_SESSION['stats202_by'] = 'DESC';
}
$query = http_build_query($get);
//build the offers202 api string
$url = TRACKING202_API_URL . "/stats202/getStats?{$query}";
#echo "<p>$url</p>";
//grab the url
$data = getUrl($url);
//parse out the array
$xmlToArray = new XmlToArray($data);
$getStats = $xmlToArray->createArray();
$getStats = $getStats['getStats'];
echo "statAccountNickName";
echo "\t" . "statImpressions";
echo "\t" . "statClicks";
echo "\t" . "statActions";
echo "\t" . "statEpc";
echo "\t" . "statTotal";
if ($getStats['stats']) {
    $stats = $getStats['stats'][0]['stat'];
}
for ($x = 0; $x < count($stats); $x++) {
    if ($stats[$x]['statClicks'] > 0) {
        $stats[$x]['statClicks'] = number_format($stats[$x]['statClicks']);
    } else {
示例#20
0
<?php 
/* loop through all configured URLs */
foreach ($configs as $inst => $config) {
    //echo "<tr><td class=text valign=top align=left>\n";
    /* get the status.xml URL of one config */
    $url = $config["base_url"] . "/status.xml?password=" . $config["status_passwd"];
    $xml_data = "";
    /* open the file description to the URL */
    if ($fp = fopen($url, "r")) {
        $bgcolor = 'green';
        /* read the XML input */
        while (!feof($fp)) {
            $xml_data .= fread($fp, 200000);
        }
        fclose($fp);
        $xml_obj = new XmlToArray($xml_data);
        $status[$inst] = cleanup_array($xml_obj->createArray());
        for ($i = 0; $i < sizeof($status[$inst]['smscs']); $i++) {
            clean_branch($status[$inst]['smscs'][$i], '');
        }
        /* get the status of this bearerbox */
        list($st, $started, $uptime) = parse_uptime($status[$inst]['status']);
        /* get the info of this bearerbox into a button, to save some screen real-estate*/
        $ver = preg_replace("/\n+/", '\\n', $status[$inst]['version']);
        $ver = preg_replace("/[\\'\\`]/", "\\'", $ver);
        $ver = 'Url: ' . $config["base_url"] . '\\n\\n' . $ver;
        $boxstatus = array('name' => '<a class="href" style="color: green; font-weight: bold" href="#" onClick="alert(\'' . $ver . '\'); return false;">' . $config['name'] . '</a>', 'bgcolor' => 'green', 'status' => $st, 'started' => $started, 'uptime' => $uptime);
    } else {
        $boxstatus = array('name' => $config['name'], 'bgcolor' => 'red', 'status' => 'error', 'started' => '-', 'uptime' => '-');
    }
    ?>