The fact that it's the mythic-beasts guys says to me they want a scripted solution that parses the question from the html, evals it, submits it, and displays the response. Seems simple at first...
eg:
Code:
<?php
$url = "http://www.mythic-beasts.com/cgi-bin/job.pl";
$input = file_get_contents($url) or die("Could not access file: $url");
function getp($string, $tagname) {
$pattern = "/<$tagname>(.*?)<\/$tagname>/";
preg_match($pattern, $string, $matches);
return $matches[1];
}
$str = $input;
$txt = getp($str, "p");
$pieces = explode(" ", $txt);
$num=count($pieces);
$end=$num - 10;
$a=1;
$question=''.$pieces[1].'';
$a++;
while($a<=$end){
$question.=$pieces[$a];
$a++;
}
$answer=eval("return $question;");
preg_match('/value="(\w+)"/',$input,$result);
$id=substr($result[0],7,-1);
echo 'QUESTION: '.$question.'<br />';
echo 'ANSWER: '.$answer.'<br />';
echo 'ID: '.$id.'<br />';
// Now, find a way to submit $answer AND $id to Job Application, and _THEN_ display the resultant output!
?> The above is functional in terms of getting the question, working out the answer, and grabbing the hidden 'id' field from the form to accompany the answer... however, it opens the job.pl to get this, and doesn't hold it open. If we add a step at the end to submit via PHP, then (1) it reloads job.pl - suspect we want job.pl to be opened and HELD open, and (2) PHP can't parse the response to tell you whether the answer is correct, quick enough, and reveal the next stage.
Crafty combo of PHP / cURL / Javascript required to handle all of this, submit results via ajax and display response. Then you can start working on the next part of the sequence for Q2...
Next step would be to submit a JSON encoded array to it and see what response is fired back.
PERFECT interview question if you're wanting to test someone's ability to problem solve AND their coding skills...