mqnoy

client.php

Aug 6th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $apiInfo = array(
  5.     'token' => '12345asdfghjkl',
  6.     'secret' => 'abcsecret'
  7. );
  8. // $apiInfo2 = array(
  9. //     "token:12345asdfghjkl",
  10. //     "secret:abcsecret"
  11. // );
  12. // $apiInfo3 = json_encode($apiInfo);
  13.  
  14. // var_dump($apiInfo);
  15. // var_dump($apiInfo2);
  16. // var_dump($apiInfo3);
  17. $URL='http://localhost/tryme/server.php';
  18. $REQUEST_METHOD='POST';
  19. $encode64="anu";
  20. // "$token =base64_encode($encode64)
  21. $REQUEST_HEADER = array(
  22.     "Content-type: application/json",
  23.     "Accept: text/xml",
  24.     "Cache-Control: no-cache",
  25.     "token: ".$apiInfo['token'],  
  26.     "secret: ".$apiInfo['secret'],  
  27.    
  28. );
  29.  
  30. $ch = curl_init();
  31. curl_setopt($ch,CURLOPT_URL,$URL);
  32. curl_setopt($ch,CURLOPT_CUSTOMREQUEST,$REQUEST_METHOD);
  33. curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  34. curl_setopt($ch,CURLOPT_POST,true);
  35. curl_setopt($ch,CURLOPT_HTTPHEADER,$REQUEST_HEADER);
  36.  
  37. $output = curl_exec($ch);
  38.  
  39.  
  40. curl_close($ch);
  41.  
  42. echo $output;
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment