Post JSON to web api in PHP

[Action] POST JSON format

{
    "command": "login",
    "params": {
        "username": "username",
        "password": "password"
    }
}

[Action] Return POST result

{
    "success": true
}

index.php

$data = array(
  'command' => 'login',
  'params' => array(
        'username' => 'username',
        'password' => 'password'    
  )
);
json_encode( $data );

$api_url = 'https://study.ar-leung.net';
$ch = curl_init( $api_url );

# Setup request to send json via POST.
$payload = json_encode( $data );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));

# Return response instead of printing.
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );

# Send request.
$result = curl_exec($ch);
curl_close($ch);

# Print response.
echo "<pre>$result</pre>";

$json_data = json_decode($result);
echo $json_data->success;

108 thoughts on “Post JSON to web api in PHP

  1. Pingback: penis dildo

  2. Pingback: https://harness4.com/cheap-mountain-bikes/

  3. Pingback: best dildo for gay

  4. Pingback: double ended stroker

  5. Pingback: mountaineering books

  6. Pingback: European

  7. Pingback: skip bin hire

  8. Pingback: Suan Sunandha Rajabhat University

  9. Pingback: suction cup dildo

  10. Pingback: realistic black dildo

  11. Pingback: adult spanking toys

  12. Pingback: best vibrators 2019

  13. Pingback: best remote vibrating panties

  14. Pingback: rechargeable vibrator

  15. Pingback: Schilderen Ravenburger

  16. Pingback: Christine Reidhead, Author

  17. Pingback: porn

  18. Pingback: giant dildo orgasm

  19. Pingback: sexy body stocking

  20. Pingback: 15% minoxidil with finasteride

  21. Pingback: 15% minoxidil with finasteride

  22. Pingback: danish design hundekurv

  23. Pingback: domino qiu qiu

  24. Pingback: https://se.mut.ac.ke/students/prospective-students.html

  25. Pingback: Julia Ann Porn

  26. Pingback: купить трудовую москва

  27. Pingback: bdjobs bank

  28. Pingback: Microsoft Office Professional Plus

  29. Pingback: Pakistani Suits

  30. Pingback: Pakistani Suits

  31. Pingback: Pentair Intellibrite

  32. Pingback: 色情影片

  33. Pingback: sexboer

  34. Pingback: geile sex filmpjes

  35. Pingback: gratis films

  36. Pingback: plumber southbury ct

  37. Pingback: iptv smarters

  38. Pingback: https://www.liteblue-login.org/liteblue-login-liteblue-usps-gov-employee-login

  39. Pingback: usps liteblue

  40. Pingback: homemade dildo porn

  41. Pingback: wand massagers

  42. Pingback: charge fingo finger vibe

  43. Pingback: virtual Mastercard

  44. Pingback: silicone rabbit vibrator

  45. Pingback: фига плод

  46. Pingback: дубцова я за ним

  47. Pingback: rammstein amour перевод

  48. Pingback: english translation

  49. Pingback: russian translation hello

  50. Pingback: male enlargement pump

  51. Pingback: trixie hundeseng

  52. Pingback: best nipple clamps

  53. Pingback: beeg com

  54. Pingback: large sex toys

  55. Pingback: مساج في القاهرة للرجال

  56. Pingback: https://www.pinterest.com/jorge7802/

  57. Pingback: walmartone login

  58. Pingback: Bluechew reviews

  59. Pingback: https://www.google.co.uk/search?source=hp&ei=t_UQXYaZL9D2-gS21YWoBA&q=porn+land+xxx&oq=porn+land+xxx&gs_l=psy-ab.3...1670.3034..3148...0.0..0.277.2389.0j7j5......0....1..gws-wiz.....0..0j0i131.T9laULQHsHQ

  60. Pingback: top 5 sex toys

  61. Pingback: فني ستلايت مبارك الكبير

  62. Pingback: best anal lubricant

  63. Pingback: podcast

  64. Pingback: sex toys

  65. Pingback: BWI transportation

  66. Pingback: permainan poker uang asli

  67. Pingback: Dulles airport pick up & drop off

  68. Pingback: vibrators

  69. Pingback: dildo

  70. Pingback: Free Funding

  71. Pingback: unboxing realistic pink vibrator

  72. Pingback: maxbet online

  73. Pingback: Ντετέκτιβ Θεσσαλονίκη

  74. Pingback: csgo spectator commands

  75. Pingback: Gmail sign in

  76. Pingback: iCloud Login

  77. Pingback: hasta yatağı kiralama

  78. Pingback: قمبل دات کام

  79. Pingback: online marketing companies

  80. Pingback: Philadelphia Elibrary

  81. Pingback: best pocket stroker

  82. Pingback: sexy underwear

  83. Pingback: döner bestellen hamburg

  84. Pingback: save sea turtle bracelet

  85. Pingback: gay sex toys porn

  86. Pingback: best couples sex toys

  87. Pingback: Hamburg sv

  88. Pingback: pleasure ring

  89. Pingback: masturbator

  90. Pingback: MIDE-675

  91. Pingback: free porn

  92. Pingback: Yt Mp3

  93. Pingback: how to use gay toys

  94. Pingback: male milking toys

  95. Pingback: d’Alembert Baccarat Strategy

  96. Pingback: unbeatable roulette system

  97. Pingback: walmartone login

  98. Pingback: hosting

  99. Pingback: davido song

  100. Pingback: cyberlink powerdirector plugins free download

  101. Pingback: outlook sign in

  102. Pingback: hotmail.com sign in

  103. Pingback: pppd 780

  104. Pingback: rabbit vibrators review

  105. Pingback: vibrating butt plug

  106. Pingback: glass anal toys

  107. Pingback: rabbit massager

  108. Pingback: anal sex starter kit

發表迴響