} function setAction($x) { $this->action = $x; } function setStartDate($x) { $this->startDate = $x; } function setEndDate($x) { $this->endDate = $x; } function sendRequest() { $req = array('userName' => 'ndap_llc', 'userPass' => 'mozllc', 'action' => 'getInvoiceInRange', 'startDate' => '20120501', 'endDate' => '20120502'); $handle = fopen("http://eorders.panetny.com/api/invoiceReport.psp?reqData=" . urlencode(json_encode($req)), "r"); $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } fclose($handle); return $contents; } } $nw = new invoiceReport(); $obj = $nw->sendRequest(); var_dump($obj); ?>
<?php //Error reporting ini_set('display_errors', 1); error_reporting(E_ALL); //load paAPI require_once '/var/www/html/magento/paGateway/reportAPI/invoiceReport.php'; //load Mage require_once "/var/www/html/magento/app/Mage.php"; Mage::app(); $config_info = parse_ini_file('/var/www/html/magento/paGateway/paGateway.ini', true); $uid = $config_info['login']['uid']; $pass = $config_info['login']['pass']; $nw = new invoiceReport(); $nw->setUser($uid, $pass); $nw->setAction('getInvoiceInRange'); //only supported function $nw->setStartDate('20120101'); //start date $nw->setEndDate('20120515'); //end date $obj = $nw->sendRequest(); // print_r($nw->sendRequest()); //send request and get response in json format $response = json_decode($obj, true); // var_dump($response); echo "<html><head></head><body style='font-family: Arial, sans-serif; font-size: 12px;'>"; echo "<table cellpadding=5 cellspacing=0 border=1>"; echo "<tr style='font-weight:bold; background-color:1D4E51; color:#f1f1f1;'>"; echo "<td>xqty</td>"; echo "<td>xprice</td>"; echo "<td>xmpline</td>";
// $db = mysql_select_db("my_db", $con); $db = mysql_select_db('ETL_Lookup', $con); if (!$db) { echo "cant select database"; } //load paAPI require_once '/var/www/html/magento/paGateway/reportAPI/invoiceReport.php'; //load Mage require_once "/var/www/html/magento/app/Mage.php"; Mage::app(); $config_info = parse_ini_file('/var/www/html/magento/paGateway/paGateway.ini', true); $uid = $config_info['login']['uid']; $pass = $config_info['login']['pass']; $today = date("Ymd"); $yesterday = date("Y-m-d", strtotime("yesterday")); $nw = new invoiceReport(); $nw->setUser($uid, $pass); $nw->setAction('getInvoiceInRange'); //only supported function // $nw->setStartDate('20111101');//start date $nw->setStartDate($yesterday); //start date $nw->setEndDate($yesterday); //end date echo "sending request \r\n"; $obj = $nw->sendRequest(); // print_r($nw->sendRequest()); //send request and get response in json format $response = json_decode($obj, true); // var_dump($response); echo "yo, request received \r\n"; if ($response) {