Skip to content

Instantly share code, notes, and snippets.

@bowlercaptain
Created September 17, 2015 03:31
Show Gist options
  • Save bowlercaptain/076a173aceffcf2b2d2f to your computer and use it in GitHub Desktop.
Save bowlercaptain/076a173aceffcf2b2d2f to your computer and use it in GitHub Desktop.
PHP (httpV2) successful login
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://superdupergames.org/auth.html",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\nauth\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"username\"\r\n\r\ntoaster\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"password\"\r\n\r\nzugzwang\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => array(
"authorization: Basic dG9hc3Rlcjp6dWd6d2FuZw==",
"content-type: multipart/form-data; boundary=---011000010111000001101001"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment