Open thakur2405 opened 8 years ago
Here is my code
<?php // Application credentials DEFINE('APPLICATION_ID', 42779); DEFINE('AUTH_KEY', "LLLxgsMYpBgmqwf"); DEFINE('AUTH_SECRET', "x7rx-j7ZMSTnBWn");
// User credentials DEFINE('USER_LOGIN', "02"); DEFINE('USER_PASSWORD', "KittyBeeArun");
// Quickblox endpoints DEFINE('QB_API_ENDPOINT', "https://api.quickblox.com"); DEFINE('QB_PATH_SESSION', "session.json");
// Generate signature $nonce = rand(); $timestamp = time(); // time() method must return current timestamp in UTC but seems like hi is return timestamp in current time zone $signature_string = "application_id=".APPLICATION_ID."&auth_key=".AUTH_KEY."&nonce=".$nonce."×tamp=".$timestamp."&user[login]=".USER_LOGIN."&user[password]=".USER_PASSWORD;
$signature = hash_hmac('sha1', $signature_string , AUTH_SECRET);
// Build post body $post_body = http_build_query(array( 'application_id' => APPLICATION_ID, 'auth_key' => AUTH_KEY, 'timestamp' => $timestamp, 'nonce' => $nonce, 'signature' => $signature, 'user[login]' => USER_LOGIN, 'user[password]' => USER_PASSWORD ));
// Configure cURL $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, QB_API_ENDPOINT . '/' . QB_PATH_SESSION); // Full path is - https://api.quickblox.com/session.json curl_setopt($curl, CURLOPT_POST, true); // Use POST curl_setopt($curl, CURLOPT_POSTFIELDS, $post_body); // Setup post body curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Receive server response
// Execute request and read responce $responce = curl_exec($curl); echo '
'; print_r($responce); die; // Check errors if ($responce) { echo $responce . "\n"; } else { $error = curl_error($curl). '(' .curl_errno($curl). ')'; echo $error . "\n"; }// Close connection curl_close($curl); ?>
I am using php, laravel 5.1. I am also testing it with core php but not working for both.
Please help me sort it out.
Thanks
Hi there,
I am not able to get the quickblox dialogs i am creating session with login and password and getting all info of with token, after that not getting the dialogs, Getting null result.