<?php
class PlaySMS
{
function Login($Login, $Pass)
{
$SAML = array('SAMLRequest' => $this->GetGateway(), 'target'=> 'https://bramka.play.pl');
$Query = $this->cURL('https://logowanie.play.pl/p4-idp2/SSOrequest.do', $SAML, 'https://bramka.play.pl/composer/public/mmsCompose.do');
preg_match('/name="random" value="(.+?)"/', $Query, $Rand);
$Post = array('step' => 1, 'next' => 'Next', 'random' => $Rand[1], 'login' => $Login, 'password' => $Pass);
$Logged = $this->cURL('https://logowanie.play.pl/p4-idp2/Login.do', $Post, '', 0);
$LoggedPost = array('SAMLResponse' => $this->GetResponse($Logged), 'target'=>'https://bramka.play.pl');
$this->cURL('https://bramka.play.pl/composer/samlLog?action=sso', $LoggedPost, 'https://logowanie.play.pl/p4-idp2/SSOrequest.do');
$this->cURL('https://bramka.play.pl/composer/j_security_check', $LoggedPost, 'https://bramka.play.pl/composer/samlLog?action=sso');
}
public function SendSMS($Number, $Text)
{
$Query = $this->cURL('https://bramka.play.pl/composer/public/editableSmsCompose.do');
preg_match('/name="randForm" value="(.+?)"/', $Query, $Rand);
$SMS = array('re*****nts' => $Number, 'content_in' => $Text, 'czas' => 0, 'sendform' => 'on', 'randForm' => $Rand[1], 'old_signature' => '', 'old_content' => $Text, 'content_out' => $Text);
$this->cURL('https://bramka.play.pl/composer/public/editableSmsCompose.do', $SMS);
$SMS['SMS_SEND_CONFIRMED'] = 'Wyślij';
$CheckQuery = $this->cURL('https://bramka.play.pl/composer/public/editableSmsCompose.do', $SMS);
if(preg_match('/Wiadomo(.*) zosta(.*)a wys(.*)ana/', $CheckQuery)) {
return true;
}
else
{
return FALSE;
}
}
function cURL($URL, $Post = NULL, $Reffer = NULL, $Follow = 1)
{
$Connect = curl_init($URL);
curl_setopt($Connect, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7');
curl_setopt($Connect, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($Connect, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($Connect, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
{
$Vars = '';
foreach ($Post as $Key => $Value)
{
}
curl_setopt($Connect, CURLOPT_POST, 1);
curl_setopt($Connect, CURLOPT_POSTFIELDS, $Vars);
}
{
curl_setopt($Connect, CURLOPT_REFERER, $Reffer);
}
curl_setopt($Connect, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($Connect, CURLOPT_HEADER, 1);
curl_setopt($Connect, CURLOPT_FOLLOWLOCATION, $Follow);
$Return = curl_exec($Connect);
curl_close($Connect);
return $Return;
}
function GetGateway()
{
$Query = $this->cURL('https://bramka.play.pl/composer/public/mmsCompose.do', NULL, '', 0);
return $Return[1];
}
public function GetResponse($Text)
{
}
function __destruct()
{
}
}
$PlaySMS = new PlaySMS();
$PlaySMS->Login('mojlogin', 'mojehaslo');
if($PlaySMS->SendSMS('nrdokogochcewyslac', 'TreśćWiadomości'))
{
echo 'Wiadomość wysłana';
}
else
{
echo 'Wiadomość niestety nie została wysłana';
}
Wyświetla mi:
Wiadomość niestety nie została wysłana.