Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'functions.php';
- class SSNAPI {
- private $accounts = array(
- 0 => array("login" => "CCCDEMO001", "password" => "1D2E3M4O01")
- );
- private $product;
- private $url = "http://creditserver.microbilt.com/SDK/postdata.asp?Member_ID={login}&Password={password}&";
- private $urlRes = "http://creditserver.microbilt.com/SDK/XMLInterface.asp?Member_ID=0&Password=0&DecFile=&OutputFormat=1&ckDecisionTable=0&ckRAWData={rawFormat}&ckCommonFormat={commonFormat}&ckXML={xmlFormat}&GUID={GUID}";
- function __construct($accountID) {
- if(count($this->accounts)==0) die('ERR: NO ACCOUNTS IN DATABASE');
- if(!$this->accounts[$accountID]) die('ERR: NO SUCH ACCOUNT ID');
- $login = $this->accounts[$accountID]['login'];
- $password = $this->accounts[$accountID]['password'];
- $newURL = preg_replace('/{login}/', $login, $this->url);
- $newURL = preg_replace('/{password}/', $password, $newURL);
- $this->url = $newURL;
- return true;
- }
- private function getGUID($params) {
- $url = $this->url.$params;
- $GUID = file_get_contents($url);
- if(strlen($GUID) < 10) $this->getGUID($params); else return $GUID;
- }
- private function getLongResult($url) {
- $i = 0;
- sleep(5);
- $RESULTS = getUrl($url); die($RESULTS);
- if(ereg('ZZZ', $RESULTS)) { sleep(1); $RESULTS = getUrl($url); }
- if(ereg('ZZZ', $RESULTS)) { sleep(1); $RESULTS = getUrl($url); }
- return $RESULTS;
- }
- private function getResults($GUID, $format) {
- $rawFormat = 0;
- $commonFormat = 0;
- $xmlFormat = 0;
- if($format == 0) $rawFormat = 1;
- if($format == 1) $commonFormat = 1;
- if($format == 2) $xmlFormat = 1;
- $url = $this->urlRes;
- $search = array('/{rawFormat}/', '/{commonFormat}/', '/{xmlFormat}/', '/{GUID}/');
- $replac = array($rawFormat, $commonFormat, $xmlFormat, $GUID);
- $resUrl = preg_replace($search, $replac, $url);
- $Output = $this->getLongResult($resUrl);
- if($this->product == "SSSBPSR") {
- $res = explode("<MESSAGE>", $Output);
- $Output = $res[1];
- }
- if($this->product == "SBPSR") {
- $res = explode("<html>", $Output);
- $res1 = explode("</html>", $res[1]);
- $search = array("/<a.*>\s(.*)<\/a>/im", "/<img.*hand\">\s/im");
- $replac = array("<a>\$1</a>", "");
- $Output = preg_replace($search, $replac, $res1[0]);
- }
- //return $res1[0];
- return $Output;
- }
- public function SBPSR($fname, $lname, $zip, $state, $city, $street) {
- $this->product = "SBPSR";
- $params = "Bureau=DS&Product=SBPSR&DPPACODE=3&FirstName=$fname&LastName=$lname&AddrType=S&Zip=$zip&State=$state&City=$city&StreetName=$street";
- $GUID = $this->getGUID($params);
- $results = $this->getResults($GUID, 1);
- return $results;
- }
- public function SSSBPSR($fname, $lname, $zip, $state, $city, $street) {
- $this->product = "SSSBPSR";
- $params = "Bureau=DS&Product=SSSBPSR&DPPACODE=3&FirstName=$fname&LastName=$lname&AddrType=S&Zip=$zip&State=$state&City=$city&StreetName=$street";
- $GUID = $this->getGUID($params);
- $results = $this->getResults($GUID, 1);
- return $results;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement