Дерево сторінок

Versions Compared

Ключ

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Програмний код
languagephp
<?php
function post_request($url, $login, $pwd)
{
$params = array('http' =>
array(
'method' => 'POST',
'header' => array('Authorization: Basic ' . base64_encode($login.":".$pwd),'Content-Type: text/xml'),
'content' => '<message><service id="single" source="<ALPHANAME>"/>
<to>+380631111111</to><body content-type="text/plain">Hello, this is ip2sms message</body></message>'
)); 
#var_dump ($params);
$ctx = stream_context_create($params);
$fp=@fopen($url, 'rb', FALSE, $ctx);
if ($fp) {
$response = @stream_get_contents($fp);
return $response;
}else{
return FALSE;
}
}
$login = '<username>';
$password = '<password>';
$answ = post_request('https://api.lifecell.com.ua/ip2sms/',$login,$password);
echo $answ;
exit;
?>