SHARE
TWEET

Untitled

a guest Oct 10th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     private function send($header = NULL, $data = NULL, $method = NULL)
  2.     {
  3.         $urlRequest = $this->server;
  4.  
  5.         $ch = curl_init();
  6.         curl_setopt($ch, CURLOPT_URL, $urlRequest);
  7.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  8.  
  9.         if (!is_null($header)) {
  10.             curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  11.         }
  12.  
  13.         if (!is_null($method)) {
  14.             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($method));
  15.         }
  16.  
  17.         if (is_array($data)) {
  18.             curl_setopt($ch, CURLOPT_POSTFIELDS, "xmlRequest=" . $data);
  19.         }
  20.  
  21.         $output = curl_exec($ch);
  22.         curl_close($ch);
  23.  
  24.         $xml = new SimpleXMLElement(json_decode($output, true));
  25.  
  26.         return $xml;
  27.     }
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