Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1.  
  2. Данный код выполняется после регистрации:
  3. <?php
  4. $fullname = 'Поле содержит имя зарегистрированного пользователя';
  5. $lastname = 'Поле содержит фамилию зарегистрированного пользователя';
  6.  
  7. $array[] = array('key' => '$name', 'value' => $fullname.' '.$lastname);
  8.  
  9. $json = json_encode($array);
  10. $url = 'https://api.carrotquest.io/v1/users/494448623963080243/props';
  11. $fields = [
  12.     'auth_token' => 'app.29882.56d02968f4619dfcb4ab3652c8e0692bc38c57fefb7885b5',
  13.     'operations' => $json,
  14.     'by_user_id' => 'true'
  15. ];
  16. $fields_string = http_build_query($fields);
  17. $ch = curl_init();
  18. curl_setopt($ch,CURLOPT_URL, $url);
  19. curl_setopt($ch,CURLOPT_POST, true);
  20. curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
  21. curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
  22. $res_curl = curl_exec($ch);
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement