-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpostfix1.php
32 lines (28 loc) · 926 Bytes
/
postfix1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
//put XML content in a string
$xmlstr=ob_get_contents();
ob_end_clean();
// Load the XML string into a DOMDocument
$xml = new DOMDocument;
$xml->loadXML($xmlstr);
// Make a DOMDocument for the XSL stylesheet
$xsl = new DOMDocument;
// See which user agent is connecting
$UA = getenv('HTTP_USER_AGENT');
if (preg_match("/Symbian/", $UA) | preg_match("/Opera/", $UA) | preg_match("/Nokia/", $UA))
{
// if a mobile phone, use a wml stylesheet and set appropriate MIME type
header("Content-type:text/vnd.wap.wml");
$xsl->load('index-wml.xsl');
}
else
{
// if not a mobile phone, use a html stylesheet
header("Content-type:text/html");
$xsl->load('admin_html.xsl');
}
// Make the transformation and print the result
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo utf8_decode($proc->transformToXML($xml));
?>