I am trying to generate a token which i need to create a **WEB SERVICE** for which i am using following code but i am not able to get a token. 

Can any one please suggest me the proper way to generate a token.

```
<?php
$adminUrl='http://magento2-dev.local/index.php/rest/V1/integration/admin/token';
$ch = curl_init();
$data = array("username" => "admin", "password" => "password");
$data_string = json_encode($data);
$ch = curl_init($adminUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data_string))
);
$token = curl_exec($ch);
$token=  json_decode($token);
echo '<pre>';
print_r($token);
exit;
?>

```