beautypg.com

Draft 1 – Aastra Telecom 9480i Series User Manual

Page 1161

background image

Creating an XML Application

41-001160-03, Rev 00, Release 2.4

F-85

Example 2:

Below is a sample php source code which sends an XML object to an Aastra
phone.

#

function push2phone($server,$phone,$data)

{

# url-encode the xml object

$xml = "xml=".urlencode($data);

$post = "POST / HTTP/1.1\r\n";

$post .= "Host: $phone\r\n";

$post .= "Referer: $server\r\n";

$post .= "Connection: Keep-Alive\r\n";

$post .= "Content-Type: application/x-www-form-urlencoded\r\n";

$post .= "Content-Length: ".strlen($xml)."\r\n\r\n";

$fp = @fsockopen ( $phone, 80, $errno, $errstr, 5);

if($fp)

{

@fputs($fp, $post.$xml);

flush();

fclose($fp);

}

}

##############################

$xml = "\n";

$xml .= "Push test\n";

$xml .= "This is a test for pushing a screen to a phone

Text>\n";

$xml .= "\n";

push2phone("172.16.96.63',"172.16.96.75",$xml);

?>

Draft 1

This manual is related to the following products: