Skip to content

Instantly share code, notes, and snippets.

@sullenfish
Created July 1, 2009 02:32
Show Gist options
  • Save sullenfish/138558 to your computer and use it in GitHub Desktop.
Save sullenfish/138558 to your computer and use it in GitHub Desktop.
<?php
$sSessionID = '8675309';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' lang='en'>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
$xhtmlDocument = new DOMDocument();
$xhtmlDocument->load('test.html');
foreach ($xhtmlDocument->getElementsByTagName('a') as $anchorElement){
$anchorElement->setAttribute('href', $anchorElement->getAttribute('href') . '&SID=' . $sSessionID);
}
$bodyElement = $xhtmlDocument->getElementsByTagName('body')->item(0);
foreach ($bodyElement->childNodes as $childElement){
echo $xhtmlDocument->saveXML($childElement);
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment