"; $firsttag = ""; //$doc = new DOMDocument(); $docb = false; if (isset($_GET['url'])) { $url = urldecode($_GET['url']); if (strpos(strtolower("*" . $url), "*http:") === false && strpos(strtolower("*" . $url), "*https:") === false && strlen($url) > 0) { if (strpos(strtolower("*" . $url), "*file:") !== false) { $url = str_replace("file:", "", str_replace("file://", "", $url)); if (substr($url,0,3) == "../" && strpos(strtolower($_SERVER['SERVER_NAME']), "rjmprogramming.com.au") !== false) { $jsspec = str_replace("/../", "/", (str_replace("*../", str_replace("//", "/", str_replace("/PHP/", "/", str_replace("/PHP//", "/", str_replace("putElementsBy.php", "", "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("?" . $_SERVER['QUERY_STRING'], "", $_SERVER['REQUEST_URI']))))), "*" . $url))); $url = str_replace("/../", "/", (str_replace("*../", str_replace("//", "/", str_replace("/PHP/", "/", str_replace("/PHP//", "/", (dirname(__FILE__) . "/")))), "*" . $isspec[$ki]))); } else if (substr($url,0,2) == "./" && strpos(strtolower($_SERVER['SERVER_NAME']), "rjmprogramming.com.au") !== false) { $jsspec = str_replace("/../", "/", (str_replace("*./", str_replace("//", "/", str_replace("/PHjunkP/", "/", str_replace("/PHjunkP//", "/", str_replace("putElementsBy.php", "", "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("?" . $_SERVER['QUERY_STRING'], "", $_SERVER['REQUEST_URI']))))), "*" . $url))); $url = str_replace("/../", "/", (str_replace("*./", str_replace("//", "/", str_replace("/PHjunkP/", "/", str_replace("/PHjunkP//", "/", (dirname(__FILE__) . "/")))), "*" . $isspec[$ki]))); } $fb = " ... file=" . $_GET['url']; if (strpos($_GET['url'] . "?", ".xml?") !== false) $isxml = true; $acont = file_get_contents($url); $cont = str_replace(" = ", "=", $acont); } else if (file_exists($url)) { $fb = " ... file=" . $_GET['url']; if (strpos($_GET['url'] . "?", ".xml?") !== false) $isxml = true; $acont = file_get_contents($url); $cont = str_replace(" = ", "=", $acont); } else { $acont = $url; //str_replace("\\" . '"', '"', $url); if ($getacont != "") { $getacont = $url; } else { $postacont = $url; } $cont = str_replace(" = ", "=", $acont); $url = ""; } } } else if (isset($_POST['url'])) { $url = urldecode($_POST['url']); if (strpos(strtolower("*" . $url), "*http:") === false && strpos(strtolower("*" . $url), "*https:") === false && strlen($url) > 0) { if (strpos(strtolower("*" . $url), "*file:") !== false) { $url = str_replace("file:", "", str_replace("file://", "", $url)); if (substr($url,0,3) == "../" && strpos(strtolower($_SERVER['SERVER_NAME']), "rjmprogramming.com.au") !== false) { $jsspec = str_replace("/../", "/", (str_replace("*../", str_replace("//", "/", str_replace("/PHP/", "/", str_replace("/PHP//", "/", str_replace("putElementsBy.php", "", "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("?" . $_SERVER['QUERY_STRING'], "", $_SERVER['REQUEST_URI']))))), "*" . $url))); $url = str_replace("/../", "/", (str_replace("*../", str_replace("//", "/", str_replace("/PHP/", "/", str_replace("/PHP//", "/", (dirname(__FILE__) . "/")))), "*" . $isspec[$ki]))); } else if (substr($url,0,2) == "./" && strpos(strtolower($_SERVER['SERVER_NAME']), "rjmprogramming.com.au") !== false) { $jsspec = str_replace("/../", "/", (str_replace("*./", str_replace("//", "/", str_replace("/PHjunkP/", "/", str_replace("/PHjunkP//", "/", str_replace("putElementsBy.php", "", "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("?" . $_SERVER['QUERY_STRING'], "", $_SERVER['REQUEST_URI']))))), "*" . $url))); $url = str_replace("/../", "/", (str_replace("*./", str_replace("//", "/", str_replace("/PHjunkP/", "/", str_replace("/PHjunkP//", "/", (dirname(__FILE__) . "/")))), "*" . $isspec[$ki]))); } $fb = " ... file=" . $_POST['url']; if (strpos($_POST['url'] . "?", ".xml?") !== false) $isxml = true; $acont = file_get_contents($url); $cont = str_replace(" = ", "=", $acont); } else if (file_exists($url)) { $fb = " ... file=" . $_POST['url']; if (strpos($_POST['url'] . "?", ".xml?") !== false) $isxml = true; $acont = file_get_contents($url); $cont = str_replace(" = ", "=", $acont); } else { $acont = $url; //str_replace("\\" . '"', '"', $url); if ($getacont != "") { $getacont = $url; } else { $postacont = $url; } $cont = str_replace(" = ", "=", $acont); //echo $cont; $url = ""; } } } if (strpos(strtolower($url) . "?", ".xml?") !== false) { $isxml = true; $firsttag = "body"; $bextras = "
"; } if (isset($_GET['selid'])) { $selid = urldecode($_GET['selid']); } if (isset($_POST['selid'])) { $selid = urldecode($_POST['selid']); } if ($selid != "") { $xselid = $selid; $onload = " onload='document.getElementById(\"uluu\").innerHTML = document.getElementById(\"uluu\").innerHTML + \"" . $fb . " ... id=\" + \"" . $selid . "\"; preaddele(\"" . $selid . "\",\"id\",\"" . $url . "\");'"; $selid = ""; } if (isset($_GET['selclass'])) { $selclass = urldecode($_GET['selclass']); } if (isset($_POST['selclass'])) { $selclass = urldecode($_POST['selclass']); } if ($selclass != "") { $xselclass = $selclass; $onload = " onload='document.getElementById(\"uluu\").innerHTML = document.getElementById(\"uluu\").innerHTML + \"" . $fb . " ... class=\" + \"" . $selclass . "\"; preaddele(\"" . $selclass . "\",\"class\",\"" . $url . "\");'"; $selclass = ""; } if (isset($_GET['seltag'])) { $seltag = urldecode($_GET['seltag']); } if (isset($_POST['seltag'])) { $seltag = urldecode($_POST['seltag']); } if ($seltag != "") { $xseltag = $seltag; $onload = " onload='document.getElementById(\"uluu\").innerHTML = document.getElementById(\"uluu\").innerHTML + \"" . $fb . " ... tag is \" + \"" . $seltag . "\"; preaddele(\"" . $seltag . "\",\"tag\",\"" . $url . "\");'"; $seltag = ""; } function overview($stuff) { global $url, $getacont, $postacont; $qurl = $url; if (isset($_GET['fil'])) { if ($_GET['fil'] != "") $qurl = $_GET['fil']; if (strpos($_GET['fil'] . "?", ".xml?") !== false) $isxml = true; } if (isset($_POST['fil'])) { if ($_POST['fil'] != "") $qurl = $_POST['fil']; if (strpos($_POST['fil'] . "?", ".xml?") !== false) $isxml = true; } if (strpos($stuff, "Please ") !== false || 1 == 1) { return "
  Parse file:




... or Url (optional):

" . $stuff . ""; } return $stuff; } if (isset($_GET['justlook']) || isset($_GET['url']) || (!isset($_GET['justlooking']) && !isset($_GET['url']) && !isset($_POST['url']))) { $classarray = array(); $sclass = array(" class=", " CLASS=", " Class="); $selclass = "
"; $idarray = array(); $sid = array(" id=", " ID=", " Id="); $selid = "
"; $tagarray = array(); $stag = array("<"); $seltag = "
"; $outtag = array("head", "script", "link", "meta", "html", "!doctype", "body", "style", "title"); $url = ""; if (isset($_GET['justlooking'])) { if (!isset($_GET['url']) && !isset($_POST['url'])) { $url = ""; $selclass = ""; $selid = ""; $seltag = ""; } } if (isset($_GET['url'])) { $url = urldecode($_GET['url']); if ($url != "" && $cont == "") { $acont = file_get_contents($url); $cont = str_replace(" = ", "=", $acont); } else if ($cont == "") { $acont = file_get_contents("http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("?" . $_SERVER['QUERY_STRING'], "", $_SERVER['REQUEST_URI']) . "?justlooking="); $cont = str_replace(" = ", "=", $acont); } else if ($cont != "") { $url = ""; } } else if (isset($_POST['url'])) { $url = urldecode($_POST['url']); if ($url != "" && $cont == "") { $acont = file_get_contents($url); $cont = str_replace(" = ", "=", $acont); } else if ($cont == "") { $acont = file_get_contents("http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("?" . $_SERVER['QUERY_STRING'], "", $_SERVER['REQUEST_URI']) . "?justlooking="); $cont = str_replace(" = ", "=", $acont); } else if ($cont != "") { $url = ""; } } else { $url = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("?" . $_SERVER['QUERY_STRING'], "", $_SERVER['REQUEST_URI']); if ($cont == "") { $acont = file_get_contents($url . "?justlooking="); $cont = str_replace(" = ", "=", $acont); } } if (isset($_GET['acont'])) { if ($_GET['acont'] != "") { $getacont = urldecode($_GET['acont']); $acont = $getacont; $cont = str_replace(" = ", "=", $acont); } } else if (isset($_POST['acont'])) { if ($_POST['acont'] != "") { $postacont = urldecode($_POST['acont']); $acont = $postacont; $cont = str_replace(" = ", "=", $acont); // file_put_contents(dirname(__FILE__) . "/abba9.xml", "*" . $acont . "*"); } } if ($isxml) $firsttag = "body"; if ($acont != "" || str_replace("http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("?" . $_SERVER['QUERY_STRING'], "", $_SERVER['REQUEST_URI']), "", $url) != "") { try { //$ch = curl_init(); //$timeout = 5; //curl_setopt($ch, CURLOPT_URL, $url); //curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); //$html = curl_exec($ch); //curl_close($ch); //echo $acont; $doc = new DOMDocument(); $doc->preserveWhiteSpace = FALSE; $before = libxml_use_internal_errors(true); if ($firsttag == "") { $doc->loadHTML($acont); } else { // file_put_contents(dirname(__FILE__) . "/abba1.xml", "*" . $acont . "*"); $doc->loadXML($acont); // file_put_contents(dirname(__FILE__) . "/abba2.xml", "*" . $acont . "*"); } libxml_use_internal_errors($before); $docb = true; // file_put_contents(dirname(__FILE__) . "/abba3.xml", "*" . $_GET['fil'] . "*" . $_POST['fil'] . "%" . $_GET['url'] . "*" . $_POST['url']); } catch (Exception $e) { throw new Exception( 'Something really wrong', 0, $e); } } function classadd($thing, $fthing) { global $classarray, $selclass, $xselclass, $cont, $bextras, $docb, $doc; $thing = str_replace("'", "", str_replace("\\", '', str_replace('"', '', $thing))); if ($thing == $xselclass) { if ($docb && 1 == 2) { foreach ($doc->getElementsByClassName($thing) as $link) { $bextras = str_replace(" ", $link->C14N() . "
", $bextras); } //foreach ($doc->getElementsByTagName($thing)->item(0)->childNodes as $link) { // $bextras = str_replace(" ", $doc->saveXML($link) . "
", $bextras); //} } else { $huh = strpos($cont, $fthing); if ($huh !== false) { $bthings = explode("<", substr($cont, 0, ($huh + strlen($fthing)))); $bis = "<" . $bthings[sizeof($bthings) - 1] . " class=" . substr($cont, (($huh + strlen($fthing)) + 8)); $words = explode(" ", $bthings[sizeof($bthings) - 1]); $huh2 = strpos($bis, ""); if ($huh2 !== false) { $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen(""))) . " ", $bextras); } else { $huh2 = strpos($bis, "/>"); if ($huh2 !== false) { $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen("/>"))) . " ", $bextras); } else { $huh2 = strpos($bis, ">"); if ($huh2 !== false) $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen(">"))) . " ", $bextras); } } } } } if (!in_array($thing, $classarray)) { $selclass = str_replace(" style='display:none;'>", ">", $selclass); $classarray[sizeof($classarray)] = $thing; $selclass = str_replace("", "", $selclass); } } function idadd($thing, $fthing) { global $idarray, $selid, $xselid, $cont, $bextras, $docb, $doc; $thing = str_replace("'", "", str_replace("\\", '', str_replace('"', '', $thing))); if ($thing == $xselid) { if ($docb) { $dobj = $doc->getElementById($thing); $bextras = str_replace(" ", $dobj->C14N() . "
", $bextras); //foreach ($doc->getElementById($thing)->item(0)->childNodes as $link) { // $bextras = str_replace(" ", $doc->saveXML($doc->getElementById($thing)->item(0)->childNodes) . "
", $bextras); //} } else { $huh = strpos($cont, $fthing); if ($huh !== false) { $bthings = explode("<", substr($cont, 0, ($huh + strlen($fthing)))); $bis = "<" . $bthings[sizeof($bthings) - 1] . " id=" . substr($cont, (($huh + strlen($fthing)) + 5)); $words = explode(" ", $bthings[sizeof($bthings) - 1]); $huh2 = strpos($bis, ""); if ($huh2 !== false) { $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen(""))) . " ", $bextras); } else { $huh2 = strpos($bis, "/>"); if ($huh2 !== false) { $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen("/>"))) . " ", $bextras); } else { $huh2 = strpos($bis, ">"); if ($huh2 !== false) $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen(">"))) . " ", $bextras); } } } } } if (!in_array($thing, $idarray)) { $selid = str_replace(" style='display:none;'>", ">", $selid); $idarray[sizeof($idarray)] = $thing; $selid = str_replace("", "", $selid); } } function tagadd($thing, $fthing, $xcont) { global $tagarray, $seltag, $outtag, $xseltag, $cont, $bextras, $firsttag, $docb, $doc, $isxml; if (($firsttag != "" || $thing == "body" || $thing == "BODY") && strpos($thing, "/") === false && strpos($thing, "*") === false && strpos($thing, "&") === false && strpos($thing, ";") === false && strpos($thing, "|") === false && strpos($thing, ",") === false && strpos($thing, "{") === false && strpos($thing, "[") === false && strpos($thing, "(") === false && substr($thing, 0, 1) != "/" && substr($thing, 0, 1) != "!") { $firsttag = "body"; // file_put_contents(dirname(__FILE__) . "/aaba.xml", "*" . $thing . "* vs *" . $xseltag . "*"); if ($thing == $xseltag) { if ($docb) { foreach ($doc->getElementsByTagName($thing) as $link) { if ($isxml) { // file_put_contents(dirname(__FILE__) . "/aabb.xml", $thing); $bextras = str_replace(" ", str_replace("$!bi$!", "", str_replace("@!bi@!", "", str_replace("<", "<", str_replace(">", ">", str_replace("<" . $thing . " ", "@!bi@!<" . $thing . " $!bi$!", str_replace("<" . $thing . ">", "@!bi@!<" . $thing . ">$!bi$!", str_replace("", "@!bi@!</" . $thing . ">$!bi$!", $link->C14N()))))))) . "
", $bextras); // file_put_contents(dirname(__FILE__) . "/aaab.xml", $bextras); } else { $bextras = str_replace(" ", $link->C14N() . "
", $bextras); } } //foreach ($doc->getElementsByTagName($thing)->item(0)->childNodes as $link) { // $bextras = str_replace(" ", $doc->saveXML($link) . "
", $bextras); //} } else { $huh = strpos($xcont, $fthing . "<"); if ($huh !== false) { $bthings = explode("<", substr($cont, 0, ($huh + strlen($fthing) + 1))); $bis = "<" . $bthings[sizeof($bthings) - 1] . $thing . substr($cont, (($huh + strlen($fthing)) + 1 + strlen($thing))); $words = explode(" ", substr($bis,1)); $huh2 = strpos($bis, ""); if ($huh2 !== false) { $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen(""))) . " ", $bextras); } else { $huh2 = strpos($bis, "/>"); if ($huh2 !== false) { $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen("/>"))) . " ", $bextras); } else { $huh2 = strpos($bis, ">"); if ($huh2 !== false) $bextras = str_replace(" ", substr($bis, 0, ($huh2 + strlen(">"))) . " ", $bextras); } } } } } if (!in_array(strtolower($thing), $tagarray)) { if (substr($thing, 0, 1) != "/" && substr($thing, 0, 1) != "!") { if (!in_array(strtolower($thing), $outtag)) { $seltag = str_replace(" style='display:none;'>", ">", $seltag); $tagarray[sizeof($tagarray)] = strtolower($thing); $seltag = str_replace("", "", $seltag); } } } } } if (isset($_GET['justlook']) || $cont != "") { //$url != "" && !isset($_GET['url']) && !isset($_POST['url'])) { if (999 == 999) { $xtag = explode($stag[0], str_replace(">", " ", str_replace("/>", " ", $cont))); for ($i=1; $igetElementsByTagName($xxtag[0]); // file_put_contents(dirname(__FILE__) . "/abbb.xml", "*" . $xxtag[0] . "*" . count($items)); if (count($items) > 0) tagadd($xxtag[0], $xtag[$i - 1], str_replace(">", " ", str_replace("/>", " ", $cont))); } catch (Exception $ee) { } } else { tagadd($xxtag[0], $xtag[$i - 1], str_replace(">", " ", str_replace("/>", " ", $cont))); } } } for ($m=0; $mgetElementsByClassName($xxclass[$j]); if (count($items) > 0) classadd($xxclass[$j], $xclass[$i - 1]); } else { classadd($xxclass[$j], $xclass[$i - 1]); } } } else if (substr($xclass[$i], 0, 1) == '"') { $xxxclass = explode('"', substr($xclass[$i], 1)); $xxclass = explode(" ", $xxxclass[0]); for ($j=0; $j<($k * sizeof($xxclass)); $j++) { if ($docb && 1 == 7) { $items = $doc->getElementsByClassName($xxclass[$j]); if (count($items) > 0) classadd($xxclass[$j], $xclass[$i - 1]); } else { classadd($xxclass[$j], $xclass[$i - 1]); } } } else { $k = 0; $xzxclass = explode(">", $xclass[$i]); $xxclass = explode(" ", $xclass[$i]); if ($docb && 1 == 7) { $items = $doc->getElementsByClassName($xxclass[$j]); if (count($items) > 0) classadd($xxclass[0], $xclass[$i - 1]); } else if (strlen($xzxclass[0]) < strlen($xxclass[0])) { classadd($xzxclass[0], $xclass[$i - 1]); } else { classadd($xxclass[0], $xclass[$i - 1]); } } } } for ($m=0; $mgetElementById($xxid[$j]); if ($item) idadd($xxid[$j], $xid[$i - 1]); } else { idadd($xxid[$j], $xid[$i - 1]); } } } else if (substr($xid[$i], 0, 1) == '"') { $xxxid = explode('"', substr($xid[$i], 1)); $xxid = explode(" ", $xxxid[0]); for ($j=0; $j<($k * sizeof($xxid)); $j++) { if ($docb) { $item = $doc->getElementById($xxid[$j]); if ($item) idadd($xxid[$j], $xid[$i - 1]); } else { idadd($xxid[$j], $xid[$i - 1]); } } } else { $k = 0; $xzxid = explode(">", $xid[$i]); $xxid = explode(" ", $xid[$i]); if ($docb) { $item = $doc->getElementById($xxid[$j]); if ($item) idadd($xxid[0], $xid[$i - 1]); } else if (strlen($xzxid[0]) < strlen($xxid[0])) { idadd($xzxid[0], $xid[$i - 1]); } else { idadd($xxid[0], $xid[$i - 1]); } } } } } } ?> The putElement(s)By Webpage - RJM Programming - November, 2014 >

The putElement(s)By Webpage -
RJM Programming - November, 2014

ways
parts

Under line under here are putElement(s)By elements