Many days ago, I read an interesting question about sending JSON data to webserver, at here: Send JSON by cURL always returns "No access".
And, bellow is full code for answer:
<?php
//API URL
$url = 'http://www.example.com/test.php';
$data = "?code=69Uy8&token=952b0f024c1e66a2a0f6f7759c2cdbfb";
//Initiate cURL.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Execute the request
$result = curl_exec($ch);
?>
Now, I want to send multiple data
values to http://www.example.com/test.php
:
code=69Uy8&token=952b0f024c1e66a2a0f6f7759c2cdbfb
code=asf5C&token=1af76d050b0831537a5f8a4153290a6f
code=U3dhB&token=b2e909fcefaeef184c01f0ac6f284db8
code=I4pe5&token=34de7a8929842f80a44abd4af4a1f0b1
code=KaoBn&token=f0e953832394a69c6ebe2d518898584a
code=bgpTb&token=82b1eb052bb4b9473a695bc42942fe88
code=gBPuf&token=9e9ffe7707cc155aba665c2ac65bba62
code=e3uAx&token=edb90988db61e78b9167116e376e9a2c
code=fje60&token=a435c033a71b2244629de402c0a650a1
code=BTdhG&token=dff6f60bf424ce67d51f7d7270a8c1d0
How to send multiple data
value to server, with JSON, by PHP?