<?php
function getContent($url, $cookiePath)
{
//used Export Cookies extension to get NC cookie
$ch = curl_init ();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 0 );
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$file_contents = curl_exec ( $ch );
if (curl_errno ( $ch )) {
echo curl_error ( $ch );
curl_close ( $ch );
exit ();
}
curl_close ( $ch );
return $file_contents;
}
$content = getContent("https://www.newbiecontest.org/epreuves/prog/prog9/epreuve9.php", 'C:/Temp/cookies.txt');
$parse = explode("\n", $content);
$config = $parse[17];
$splitConfig = explode(". ", $config);
$i=0;
$listSize = count($splitConfig);
foreach ($splitConfig as &$conf)
{
if ( $i <= $listSize -2 )
{
$splitConf = explode(" ", $conf);
$name[$i] = $splitConf[0];
echo "Nom : " . $name[$i] . "<br />";
$proc[$i] = $splitConf[5] . " " . $splitConf[6];
echo "Proc : " . $proc[$i] . "<br />";
$ram[$i] = $splitConf[10] . " " . $splitConf[11] . " " . $splitConf[12];
echo "RAM : " . $ram[$i] . "<br /><br />";
}
$i++;
}
echo "<br /><br />";
$splitPrice = explode("<tr align='center'>", $content);
$priceSize = count($splitPrice);
//print_r($splitPrice);
for ($j=1;$j<10;$j++)
{
$denom = strip_tags($splitPrice[$j]);
$splitPri = explode(" ", $denom);
$ramPrice = (int) substr($denom, -5);
$denomList = $splitPri[0] . " " . $splitPri[1] . " " . $splitPri[2];
if ( $j != 8 || $j != 9)
{
$denomList = substr($denomList, 0, -5);
}
if ( $j == 9 )
{
$ramPrice = "Trop chère ;)";
}
echo "Label : " . $denomList . "<br />";
echo "Price : " . $ramPrice . "<br /><br />";
}
echo "<br /><br />";
for ($j=10;$j<$priceSize;$j++)
{
$procList = strip_tags($splitPrice[$j]);
$procPrice = (int) substr($procList, -4);
$splitprocList = explode(" ", $procList);
$denomList = substr($procList, 0, -6);
if ( $j == 10 )
{
$denomList = substr($procList, 0, -19);
$procPrice = "N'existe plus ;)";
}
if ( $j == 19 )
{
$procPrice = (int) substr($procList, -11);
}
echo "Label : " . $denomList . "<br />";
echo "Price : " . $procPrice . "<br /><br />";
}
//$subm = "https://www.newbiecontest.org/epreuves/prog/verifpr6.php?solution=" . $solution;
//header("Location: $subm");
?>
Comments
0 B
|👍
/👎