Error sending request $body

"; } function parsePost($post = array()) { if($post['INFO2'] and $post['INFO']) { // parse body (selected is not specified) $body_prefix = "&INFO2=$post[INFO2]&INFO=$post[INFO]&SELECTED="; for($i = 4; $i > 1; $i--) { sendRequest($body_prefix . "$i"); } } return sendRequest($body_prefix . "1", true); } function parsePage($html, $post = array('BASE_GRAIN' => -20)) { // by default $post['ANSWER'] = $post['ERROR'] = false; // no page? server error! if($html == "") { $post['ERROR'] = "server unresponsive"; } // we bugged them too much else if(strpos($html, '
')) { $post['ERROR'] = "request too fast"; } // looks like things are fine else { // get INFO $post['INFO'] = preg_match("##", $html, $match) ? $match[1] : ""; // get INFO2 $post['INFO2'] = preg_match("##", $html, $match) ? $match[1] : ""; // get word $post['WORD'] = preg_match("#(\w+) means#", $html, $match) ? $match[1] : "error"; // if correct, get the answer $post['ANSWER'] = preg_match("#
[\w\s]+ = ([\w\s]+)
#", $html, $match) ? $match[1] : false; // increment grain count $post['BASE_GRAIN'] += 20; } return $post; } // get the starting point, either from session or from a new request $post = $_SESSION['progress'] ? $_SESSION['progress'] : parsePage(parsePost()); $word = $post['WORD']; // get the page and save to session $_SESSION['progress'] = $post = parsePage(parsePost($post), $post); // start outputting headers @header("HTTP/1.0 200 OK"); @header("HTTP/1.1 200 OK"); @header("Content-type: text/html"); // don't cache, please @header("Cache-Control: no-cache, must-revalidate, max-age=0"); @header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); @header("Pragma: no-cache"); if($post['ERROR']) { echo "

Error: $post[ERROR]

\n"; } else { // show answer if first guess was correct if($post['ANSWER']) { $word .= " ($post[ANSWER])"; } // print the stuff echo "

$word: donated $post[BASE_GRAIN] grains.

\n"; } // calculate execution time $endTime = explode(' ', microtime ()); $execTime = ($endTime[1] + $endTime[0]) - ($startTime[1] + $startTime[0]); // save execution time $_SESSION['totalTime'] += $execTime; // round them to five decimals $totalTime = round ($_SESSION['totalTime'], 5); $timeUsed = round ($execTime, 5); // print the execution time echo "

This load took $timeUsed seconds. You have used $totalTime seconds. Please wait one second...

"; ?>