Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. <?php
  2. require 'functions.php';
  3.  
  4. class SSNAPI {
  5.  
  6. private $accounts = array(
  7. 0 => array("login" => "CCCDEMO001", "password" => "1D2E3M4O01")
  8. );
  9. private $product;
  10.  
  11. private $url = "http://creditserver.microbilt.com/SDK/postdata.asp?Member_ID={login}&Password={password}&";
  12. 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}";
  13.  
  14. function __construct($accountID) {
  15.  
  16. if(count($this->accounts)==0) die('ERR: NO ACCOUNTS IN DATABASE');
  17. if(!$this->accounts[$accountID]) die('ERR: NO SUCH ACCOUNT ID');
  18.  
  19. $login = $this->accounts[$accountID]['login'];
  20. $password = $this->accounts[$accountID]['password'];
  21. $newURL = preg_replace('/{login}/', $login, $this->url);
  22. $newURL = preg_replace('/{password}/', $password, $newURL);
  23. $this->url = $newURL;
  24.  
  25. return true;
  26.  
  27. }
  28.  
  29. private function getGUID($params) {
  30. $url = $this->url.$params;
  31. $GUID = file_get_contents($url);
  32. if(strlen($GUID) < 10) $this->getGUID($params); else return $GUID;
  33. }
  34.  
  35. private function getLongResult($url) {
  36. $i = 0;
  37.  
  38. sleep(5);
  39. $RESULTS = getUrl($url); die($RESULTS);
  40.  
  41. if(ereg('ZZZ', $RESULTS)) { sleep(1); $RESULTS = getUrl($url); }
  42. if(ereg('ZZZ', $RESULTS)) { sleep(1); $RESULTS = getUrl($url); }
  43.  
  44. return $RESULTS;
  45. }
  46.  
  47. private function getResults($GUID, $format) {
  48. $rawFormat = 0;
  49. $commonFormat = 0;
  50. $xmlFormat = 0;
  51. if($format == 0) $rawFormat = 1;
  52. if($format == 1) $commonFormat = 1;
  53. if($format == 2) $xmlFormat = 1;
  54.  
  55. $url = $this->urlRes;
  56.  
  57. $search = array('/{rawFormat}/', '/{commonFormat}/', '/{xmlFormat}/', '/{GUID}/');
  58. $replac = array($rawFormat, $commonFormat, $xmlFormat, $GUID);
  59.  
  60. $resUrl = preg_replace($search, $replac, $url);
  61.  
  62. $Output = $this->getLongResult($resUrl);
  63.  
  64. if($this->product == "SSSBPSR") {
  65. $res = explode("<MESSAGE>", $Output);
  66.  
  67. $Output = $res[1];
  68. }
  69. if($this->product == "SBPSR") {
  70. $res = explode("<html>", $Output);
  71. $res1 = explode("</html>", $res[1]);
  72. $search = array("/<a.*>\s(.*)<\/a>/im", "/<img.*hand\">\s/im");
  73. $replac = array("<a>\$1</a>", "");
  74.  
  75. $Output = preg_replace($search, $replac, $res1[0]);
  76. }
  77.  
  78. //return $res1[0];
  79. return $Output;
  80. }
  81.  
  82. public function SBPSR($fname, $lname, $zip, $state, $city, $street) {
  83. $this->product = "SBPSR";
  84. $params = "Bureau=DS&Product=SBPSR&DPPACODE=3&FirstName=$fname&LastName=$lname&AddrType=S&Zip=$zip&State=$state&City=$city&StreetName=$street";
  85. $GUID = $this->getGUID($params);
  86. $results = $this->getResults($GUID, 1);
  87.  
  88. return $results;
  89. }
  90.  
  91. public function SSSBPSR($fname, $lname, $zip, $state, $city, $street) {
  92. $this->product = "SSSBPSR";
  93. $params = "Bureau=DS&Product=SSSBPSR&DPPACODE=3&FirstName=$fname&LastName=$lname&AddrType=S&Zip=$zip&State=$state&City=$city&StreetName=$street";
  94. $GUID = $this->getGUID($params);
  95. $results = $this->getResults($GUID, 1);
  96.  
  97. return $results;
  98. }
  99. }
  100. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement