everyone! my question is about HTTP headers and how to send my array to server. my array is :
$postdata = array(
'user' => $user,
'timestamp' => $timestamp,
'hash' => $hash
);
i want to send my array with curl() to server but in header, and i use slim in my server. my client side is :
$url = 'localhost/test';
$ch = curl_init();
curl_setopt($ch, CURLOPT_url, $url);
curl_setopt($ch, RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $postdata);
$response = curl_exec($ch);
echo $response;
curl_close($ch);
My server side is :
require('slim/slim.php');
\slim\slim::registerAutoloader();
$app = new \slim\slim(array('debug' => true, 'mode' => 'development'));
$app->contentType('application/json;charset=utf-8');
$app-get('test', 'mockup');
$app->run();
function mockup() {/* ... */}