Advertisement
Brandan

Untitled

Oct 28th, 2013
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.43 KB | None | 0 0
  1. THIS HAS BEEN SOLVED!! THANK YOU!
  2.  
  3. ATTENTION: THIS IS HOW THE CODE IS SUPPORT TO WORK -> http://pastebin.com/gbc4fCDx
  4. This code returns an error from the server like '0|error|500||'
  5. <?PHP
  6.  
  7. echo (WCCCA_callInfo());
  8.  
  9. function WCCCA_callInfo()
  10. {
  11.     $header = "Cache-Control: no-cache\r\n" .
  12.               "Origin: http://www.wccca.com\r\n" .
  13.               "X-MicrosoftAjax: Delta=true\r\n" .
  14.               "User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36\r\n" .
  15.               "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n" .
  16.               "Accept: */*\r\n" .
  17.               "Referer: http://www.wccca.com/PITSv2/\r\n" .
  18.               "X-McProxyFilter: *****************\r\n" .
  19.               "Accept-Language: en-US,en;q=0.8\r\n" .
  20.               "Cookie: __utma=247398914.650647853.1373700322.1382880873.1382940433.232; __utmb=247398914.500.9.1382948378163; __utmc=247398914; __utmz=247398914.1375889172.59.2.utmcsr=tvfr.com|utmccn=(referral)|utmcmd=referral|utmcct=/\r\n";
  21.    
  22.     $VIEWSTATE       = WCCCA_HIDDEN_CODE("VIEWSTATE");
  23.     $EVENTVALIDATION = WCCCA_HIDDEN_CODE("EVENTVALIDATION");
  24.     $postData        = "smMain=smMain%7CtmrIncidents&__EVENTTARGET=tmrIncidents&__EVENTARGUMENT=&__VIEWSTATE=" . $VIEWSTATE . "&__EVENTVALIDATION=" . $EVENTVALIDATION . "&__ASYNCPOST=true&";
  25.     $Calls = post("http://www.wccca.com/PITSv2/Default.aspx", $postData, $header);
  26.     return $Calls;
  27. }
  28.  
  29. function WCCCA_HIDDEN_CODE($input) // Get hidden code
  30. {
  31.     $data    = file_get_contents("http://www.wccca.com/PITSv2/Default.aspx");
  32.     $pattern = "/id=\"__" . $input . "\" value=\"([^\"]+)\"/";
  33.     preg_match_all($pattern, $data, $xmlext);
  34.    
  35.     // Removes all slashes.
  36.     $code = str_replace("/", "", $xmlext[1][0]);
  37.     return $code;
  38. }
  39.  
  40. function post($url, $data, $optional_headers = null)
  41. {
  42.     $params = array(
  43.         'http' => array(
  44.             'method' => 'POST',
  45.             'content' => trim(preg_replace('/\s\s+/', ' ', $data))
  46.         )
  47.     );
  48.     if ($optional_headers !== null) {
  49.         $params['http']['header'] = $optional_headers;
  50.     }
  51.     $ctx = stream_context_create($params);
  52.     $fp  = @fopen($url, 'rb', false, $ctx);
  53.     if (!$fp) {
  54.         throw new Exception("Problem with $url, $php_errormsg");
  55.     }
  56.     $response = @stream_get_contents($fp);
  57.     if ($response === false) {
  58.         throw new Exception("Problem reading data from $url, $php_errormsg");
  59.     }
  60.     return $response;
  61. }
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement