Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1. <?php
  2.  
  3. echo "\nHello World.\n";
  4.  
  5. $signUp;
  6. $signUp["Host"] = " ishin-global.aktsk.com"; //generic host url;
  7. $signup["Accept"]=" */*";
  8. $signUp["Content-Type"]=" application/json";
  9. $signUp["X-Platform"]=" android";
  10. $signUp["X-ClientVersion"]=" 3.3.1"; //Can be pseudo static in nature
  11. $signUp["Content-Length"]=" 252";
  12.  
  13.  //echo $info;
  14.  echo $signUp["X-ClientVersion"];
  15. //echo "connect to "."http://ishin-global.aktsk.com/auth/sign_up";
  16. $payLoad='{"user_account":{"ad_id":"9e2170cd-bded-4103-9274-fbfefc7cf14a","country":"US","currency":"USD","device":"Google","device_model":"Pixel XL","os_version":"7.1.2","platform":"android","unique_id":"ecaf41c8-c478-4865-b0f8-af0e7bfa4484:b2f53b1d34d823f1"}}';
  17.  
  18. $payLoad = json_decode($payLoad,true);
  19.  
  20. if(json_last_error()=== 0)
  21. {
  22.     echo "Payload is valid JSON";
  23. }
  24. else
  25. {
  26.     echo "Payload is not valid JSON";
  27. }
  28.  
  29. connect("http://ishin-global.aktsk.com/auth/sign_up", $signUp,$payLoad);
  30.  
  31.  
  32.  
  33.  
  34.  function connect($url,$dataArray,$payLoad)
  35.  {
  36.      $channel = curl_init(); //establishing cURL connection;
  37.      
  38.      curl_setopt($channel,CURLOPT_URL,$url);
  39.      curl_setopt($channel,CURLOPT_POST,1);
  40.      curl_setopt( $channel, CURLOPT_HTTPHEADER,$dataArray);
  41.      curl_setopt($channel, CURLOPT_POSTFIELDS, json_encode($payLoad));//Fields of the POST
  42.      //curl_setopt($channel,CURLOPT_RETURNTRANSFER,true);
  43.      
  44.      $respone = curl_exec($channel);
  45.      
  46.      if(isset($response))
  47.      {
  48.      echo "\nResponse ".$response."\n";
  49.      }
  50.      
  51.      curl_close($channel);
  52.      
  53.  }
  54.  
  55.  
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement