Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. {
  2. "a": "sss",
  3. "b": "aaaa",
  4. "c": "ddd",
  5. "d": "ff",
  6. "e": 0,
  7. "f": "GMT+07:00",
  8. "g": "",
  9. "h": "",
  10. "i": "rrr",
  11. "k": "hhh",
  12. "l": "14.0.0",
  13. "m": [
  14. {
  15. "n": 5,
  16. "o": "xxx"
  17. }
  18. ]
  19. }
  20.  
  21. function httpPost2($url,$params,$protocol="http")
  22. {
  23.  
  24. $data_string = $params;
  25.  
  26. $ch = curl_init($url);
  27. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  28. curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
  29. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  30. curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  31. 'Content-Type: application/json',
  32. 'Content-Length: ' . strlen($data_string))
  33. );
  34.  
  35. $result = curl_exec($ch);
  36.  
  37. }
  38.  
  39. $posted= httpPost2("xxx/Elp/JSON/Authe",$posted) .'<br/>';
  40. var_dump($posted);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement