Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var u = "CENTRAL\myusername";
- var p = "myp@ssword";
- var payload = {
- username: u,
- password: p,
- client: 'referer',
- referer: 'https://mycompany.com/myapp',
- expiration: '60',
- format: 'json',
- };
- var tokenUrl = 'https://gis.mycompany.com/public/tokens/generateToken';
- $.ajax({
- url: tokenUrl,
- type: "POST",
- crossDomain: true,
- dataType: 'text',
- data: payload,
- success: function(data){
- token = data;
- console.log(token)
- }
- });
- $GISuser = "CENTRAL\myusername";
- $GISpassword = "myp@ssword";
- $GISurl = "https://gis.mycompany.com/public/tokens/generateToken";
- $payload = array(
- "username" => $GISuser,
- "password" => $GISpassword,
- "client" => "referer",
- "referer" => 'https://mycompany.com/myapp',
- "expiration" => "60",
- "format" => "json"
- );
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
- curl_setopt($curl, CURLOPT_URL, $GISurl);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- $result = curl_exec($curl);
- curl_close($curl);
- echo $result;
Add Comment
Please, Sign In to add comment