$client = new \SoapClient
(
DOCROOT . "ex.wsdl" ,
[
'login' => $this->username,
'password' => $this->password,
'soap_version' => '1.2',
'cache_wsdl' => WSDL_CACHE_NONE,
'features' => SOAP_USE_XSI_ARRAY_TYPE,
'location' => $this->location,
'exceptions' => true,
'trace' => true
]
);
$mail = new \PHPMailer;
$mail->setFrom('email@from', 'from name');
$mail->addAddress('user@email','user name');
$mail->addReplyTo('user@email','user name');
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'my subject';
$mail->Body = " my message body";
if(!$mail->send()) {
$error[] = $mail->ErrorInfo;
}
private function getUserIp(){
if (!empty($_SERVER['HTTP_X_REAL_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_X_REAL_IP'];
}
elseif (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}