request('GET', 'http://quantbet.com/quiz/dev', [ 'cookies' => $jar, ]); preg_match_all('#([0-9]+)#', $res->getBody()->getContents(), $matches); $gmp = gmp_gcd($matches[1][0], $matches[1][1]); $answer = gmp_strval($gmp); $res = $client->request('POST', 'http://www.quantbet.com/submit', [ 'cookies' => $jar, 'form_params' => [ 'divisor' => $answer, ], ]); echo $res->getBody()->getContents();