$url, CURLOPT_HTTPHEADER => array('Content-Type: application/x-www-form-urlencoded'), // Enable the post response. CURLOPT_POST => true, // The data to transfer with the response. CURLOPT_POSTFIELDS => $postdata, CURLOPT_RETURNTRANSFER => true, ) ); // execute! $response = curl_exec($ch); unset($postdata); // close the connection, release resources used curl_close($ch); // do anything you want with your response $response_array = json_decode($response, true); $token = $response_array['token']; var_dump($token); unset($token); unset($reponse_array); ?>