Improve output of test.php

This commit is contained in:
Skylar Ittner 2018-07-25 17:24:08 -06:00
parent f5ca72b318
commit 6c12179b49
1 changed files with 9 additions and 5 deletions

View File

@ -2,10 +2,6 @@
header("Content-Type: text/plain");
var_dump($_POST);
$url = 'https://captcheck.netsyms.com/api.php';
$data = [
'session_id' => $_POST['captcheck_session_code'],
@ -22,8 +18,16 @@ $options = [
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$resp = json_decode($result, TRUE);
echo "Form fields:\n";
var_export($_POST);
echo "\n\nAPI request fields:\n";
var_export($data);
echo "\n\nAPI response (JSON):\n";
echo json_encode(json_decode($result, TRUE), JSON_PRETTY_PRINT);
if (!$resp['result']) {
exit("\n\nCAPTCHA did not verify:" . $resp['msg']);
exit("\n\nCAPTCHA did not verify: " . $resp['msg']);
} else {
exit("\n\nCAPTCHA verified!");
}