Skip to content

Instantly share code, notes, and snippets.

@0xsan-z
Last active February 27, 2021 20:32
Show Gist options
  • Save 0xsan-z/b6ef0f02e32469b87db85ded19eeab78 to your computer and use it in GitHub Desktop.
Save 0xsan-z/b6ef0f02e32469b87db85ded19eeab78 to your computer and use it in GitHub Desktop.
PHP request with parameters for TryHackMe's room named Lunizz CTF
<?php
//https://stackoverflow.com/questions/5647461/how-do-i-send-a-post-request-with-php
$url = 'http://10.8.98.192:8080/';
$data = array('password' => '[REDACTED]', 'cmdtype' => 'lsla');
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
var_dump($result);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment