User:Cakemix/Scripts/PHP/ColorShit

<?PHP

/*Stuff you can't see :]*/

unset($pass); require_once '../Zend/Json.php';

function datapost($URLServer, $postdata) {

$agent = "Mozilla/5.0";

$cURL_Session = curl_init;

curl_setopt($cURL_Session, CURLOPT_URL, $URLServer);

curl_setopt($cURL_Session, CURLOPT_USERAGENT, $agent);

curl_setopt($cURL_Session, CURLOPT_POST, 1);

curl_setopt($cURL_Session, CURLOPT_POSTFIELDS, $postdata);

curl_setopt($cURL_Session, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($cURL_Session, CURLOPT_FOLLOWLOCATION, 1);

$result = curl_exec($cURL_Session);

return $result; }

$data = ' {| border="1" cellpadding="4" !Color !RGB '; $u = true; $i = 0; while (true) { $c = datapost("http://www.colourlovers.com/api/colors/top", "format=json&numResults=100&resultOffset=" . $i); if ($c == null): $data .= "|}"; $darray[] = $data; $data = ' {| border="1" cellpadding="4" !Color !RGB ';       break; endif; $y = (Zend_Json::decode($c)); foreach ($y as $key => $value) { extract($y[$key]); $data.= '|- !style="background-color: rgb(' . $rgb['red'] . ', ' . $rgb['green'] . ', ' . $rgb['blue'] . ');"|#'. $hex. ' !style="background-color: rgb(' . $rgb['red'] . ', ' . $rgb['green'] . ', ' . $rgb['blue'] . ');"|rgb(' . $rgb['red'] . ', ' . $rgb['green'] . ', ' . $rgb['blue'] . ') ';   }

$i +=100; $a = $i; if ($a > 299): $data .= "|}"; $darray[] = $data; $data = ' {| border="1" cellpadding="4" !Color !RGB ';   endif; if ($a > 1599): break; endif; } $i = 0; while ($i < count($darray) - 1) { $i++; $v .= "Colors/Page $i "; } $v .= " "; foreach ($darray as $key => $value) { $value = $v. $value; $wiki->edit("Colors/Page $key", $value, ""); }