Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- <?php
- /* If having questions, contact Veetor Nara via evemail or convo. */
- /* Save this output to kills.txt (Stripping the array( ) out of it) */
- $data = array();
- function extractSystemPage($page = 1) { // paging starts with 1
- $systemlink = "http://zkillboard.com/system/30005297/page/$page/";
- $rawpage = file_get_contents($systemlink);
- $doc = new DOMDocument();
- @$doc->loadHTML($rawpage);
- $xpath = new DOMXPath($doc);
- $nodes = $xpath->query("//table/tbody/tr[@class = 'winwin killListRow']");
- foreach( $nodes as $node ) {
- walkDom($node);
- }
- }
- for ( $i=1; $i < 23; $i++ ) {
- echo "extracting page #1... ";
- set_time_limit (120);
- sleep(1);
- extractSystemPage($i);
- }
- $data = array_unique($data);
- print_r($data);
- function walkDom($node) {
- if ( $node->nodeType == XML_ELEMENT_NODE ) {
- $attributes = $node->attributes; // get all the attributes(eg: id, class)
- foreach($attributes as $attribute) {
- //echo ', '.$attribute->name.'='.trim($attribute->value);
- if ($attribute->name == "href") { // /kill/id/
- $arr = explode("/",$attribute->value);
- if ($arr[1] == "kill") {
- // Kills are between the event
- if ($arr[2] <= "44615772" && $arr[2] >= "44581979") {
- addKillID($arr[2]);
- }
- }
- }
- }
- }
- $cNodes = $node->childNodes;
- if (count($cNodes) > 0) {
- foreach($cNodes as $cNode)
- walkDom($cNode);
- }
- }
- function addKillID($id) {
- global $data;
- $data[] = $id;
- }
- ?></pre>
Advertisement
Add Comment
Please, Sign In to add comment