Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors',1);
- ini_set('display_startup_errors',1);
- error_reporting(-1);
- $data = array("username" => "derped", "authid" => "987654321", "ipaddress" => "1.2.3.4", "apikey" => "1234567829");
- $data_string = json_encode($data);
- $url = 'https://www.somedomain.com/test/api.php';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: Content-Type: text/html'));
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $result = curl_exec($ch);
- if(curl_exec($ch) === false)
- {
- echo curl_error($ch);
- }
- else
- {
- echo 'ok';
- }
- curl_close($ch);
- $received = json_decode($result);
- $check = $received->{'good'};
- echo $result;
- echo $check;
- ?>
- $arrayCiphers = array(
- 'DHE-RSA-AES256-SHA',
- 'DHE-DSS-AES256-SHA',
- 'AES256-SHA:KRB5-DES-CBC3-MD5',
- 'KRB5-DES-CBC3-SHA',
- 'EDH-RSA-DES-CBC3-SHA',
- 'EDH-DSS-DES-CBC3-SHA',
- 'DES-CBC3-SHA:DES-CBC3-MD5',
- 'DHE-RSA-AES128-SHA',
- 'DHE-DSS-AES128-SHA',
- 'AES128-SHA:RC2-CBC-MD5',
- 'KRB5-RC4-MD5:KRB5-RC4-SHA',
- 'RC4-SHA:RC4-MD5:RC4-MD5',
- 'KRB5-DES-CBC-MD5',
- 'KRB5-DES-CBC-SHA',
- 'EDH-RSA-DES-CBC-SHA',
- 'EDH-DSS-DES-CBC-SHA:DES-CBC-SHA',
- 'DES-CBC-MD5:EXP-KRB5-RC2-CBC-MD5',
- 'EXP-KRB5-DES-CBC-MD5',
- 'EXP-KRB5-RC2-CBC-SHA',
- 'EXP-KRB5-DES-CBC-SHA',
- 'EXP-EDH-RSA-DES-CBC-SHA',
- 'EXP-EDH-DSS-DES-CBC-SHA',
- 'EXP-DES-CBC-SHA',
- 'EXP-RC2-CBC-MD5',
- 'EXP-RC2-CBC-MD5',
- 'EXP-KRB5-RC4-MD5',
- 'EXP-KRB5-RC4-SHA',
- 'EXP-RC4-MD5:EXP-RC4-MD5');
- curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, implode(':', $arrayCiphers));
- $data = new stdClass();
- $data->apikey = "1234567890";
- $json_data = json_encode($data);
- $post = file_get_contents('http://URL/api.php',null,stream_context_create(array(
- 'http' => array(
- 'method' => 'POST',
- 'content' => $json_data,
- )
- )));
- if ($post) {
- echo $post;
- } else {
- echo "POST failed";
- }
- $receive = fopen('php://input', 'r');
- $received = stream_get_contents($receive);
- $data = json_decode($received);
- $apikey = $data->{'apikey'};
- If($apikey == 1234567890)
- {
- $response = array("good" => true);
- $goresponse = json_encode($response);
- print_r($goresponse);
- }
- else
- {
- $response = array("good" => false);
- $goresponse = json_encode($response);
- print_r($goresponse);
- }
Add Comment
Please, Sign In to add comment