daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. ini_set('display_errors',1);
  3. ini_set('display_startup_errors',1);
  4. error_reporting(-1);
  5.  
  6. $data = array("username" => "derped", "authid" => "987654321", "ipaddress" => "1.2.3.4", "apikey" => "1234567829");
  7. $data_string = json_encode($data);
  8. $url = 'https://www.somedomain.com/test/api.php';
  9. $ch = curl_init();
  10. curl_setopt($ch, CURLOPT_URL, $url);
  11. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: Content-Type: text/html'));
  12. curl_setopt($ch, CURLOPT_POST, 1);
  13. curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  15. $result = curl_exec($ch);
  16. if(curl_exec($ch) === false)
  17. {
  18.     echo curl_error($ch);
  19. }
  20. else
  21. {
  22.     echo 'ok';
  23. }
  24.  
  25. curl_close($ch);
  26.  
  27. $received = json_decode($result);
  28. $check = $received->{'good'};
  29. echo $result;
  30. echo $check;
  31. ?>
  32.    
  33. $arrayCiphers = array(
  34.     'DHE-RSA-AES256-SHA',
  35.     'DHE-DSS-AES256-SHA',
  36.     'AES256-SHA:KRB5-DES-CBC3-MD5',
  37.     'KRB5-DES-CBC3-SHA',
  38.     'EDH-RSA-DES-CBC3-SHA',
  39.     'EDH-DSS-DES-CBC3-SHA',
  40.     'DES-CBC3-SHA:DES-CBC3-MD5',
  41.     'DHE-RSA-AES128-SHA',
  42.     'DHE-DSS-AES128-SHA',
  43.     'AES128-SHA:RC2-CBC-MD5',
  44.     'KRB5-RC4-MD5:KRB5-RC4-SHA',
  45.     'RC4-SHA:RC4-MD5:RC4-MD5',
  46.     'KRB5-DES-CBC-MD5',
  47.     'KRB5-DES-CBC-SHA',
  48.     'EDH-RSA-DES-CBC-SHA',
  49.     'EDH-DSS-DES-CBC-SHA:DES-CBC-SHA',
  50.     'DES-CBC-MD5:EXP-KRB5-RC2-CBC-MD5',
  51.     'EXP-KRB5-DES-CBC-MD5',
  52.     'EXP-KRB5-RC2-CBC-SHA',
  53.     'EXP-KRB5-DES-CBC-SHA',
  54.     'EXP-EDH-RSA-DES-CBC-SHA',
  55.     'EXP-EDH-DSS-DES-CBC-SHA',
  56.     'EXP-DES-CBC-SHA',
  57.     'EXP-RC2-CBC-MD5',
  58.     'EXP-RC2-CBC-MD5',
  59.     'EXP-KRB5-RC4-MD5',
  60.     'EXP-KRB5-RC4-SHA',
  61.     'EXP-RC4-MD5:EXP-RC4-MD5');
  62. curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, implode(':', $arrayCiphers));
  63.    
  64. $data = new stdClass();
  65. $data->apikey = "1234567890";
  66.  
  67. $json_data = json_encode($data);
  68.  
  69. $post = file_get_contents('http://URL/api.php',null,stream_context_create(array(
  70.     'http' => array(
  71.         'method'           => 'POST',
  72.         'content'          => $json_data,
  73.     )
  74. )));
  75.  
  76. if ($post) {
  77.     echo $post;
  78. } else {
  79.     echo "POST failed";
  80. }
  81.    
  82. $receive = fopen('php://input', 'r');
  83. $received = stream_get_contents($receive);
  84. $data = json_decode($received);
  85. $apikey = $data->{'apikey'};
  86. If($apikey == 1234567890)
  87. {
  88.     $response = array("good" => true);
  89.     $goresponse = json_encode($response);
  90.     print_r($goresponse);
  91. }
  92. else
  93. {
  94.     $response = array("good" => false);
  95.     $goresponse = json_encode($response);
  96.     print_r($goresponse);
  97. }
RAW Paste Data
Top