Advertisement
Guest User

Untitled

a guest
Jan 10th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4.  
  5. $login = 'InternetWDS';
  6. $password = 'hm7PdQdapzkv';
  7. $to = '380671098211';
  8. $body = 'KremenetsWDS http://www.kwds.net.ua; user:bormak password:1128901';
  9.  
  10.  
  11. $answ = post_request('https://api.life.com.ua/ip2sms/', $login, $password, $to, $body);
  12. echo $answ;
  13.  
  14.  
  15. function post_request($url, $login, $pwd, $to, $body)
  16. {
  17.          $params = array('http' =>
  18.                          array(
  19.                             'method' => 'POST',
  20.                             'header' => array('Authorization: Basic ' . base64_encode($login.":".$pwd),
  21.                                            'Content-Type: text/xml'),
  22.                             'content' => "<message><service id='single' source='InternetWDS'/><to>".$to."</to><body content-type='text/plain'>".$body."</body></message>"
  23.                          ));
  24.  
  25.          var_dump ($params);
  26.  
  27.  
  28.          $ctx = stream_context_create($params);
  29.          $fp=@fopen($url, 'rb', FALSE, $ctx);
  30.          if ($fp) {
  31.                          $response = @stream_get_contents($fp);
  32.                          return $response;
  33.          }else{
  34.                          return FALSE;
  35.          }
  36. }
  37.  
  38. exit;
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement