onlinecode

Proxyclick API using php

Proxyclick API using php

In this post we will show you Proxyclick API using php “, hear for Proxyclick API using php “ we will give you demo and example for implement.

Proxyclick API using php

Read More

$ curl  \
-X POST \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d client_id="FBC595DE2B6476286C1FEAB16A9" \
-d client_secret="783CCFE496BE8D69EEF798560" \
-d grant_type="password" \
-d username="example@email.com" \
-d password="password"

HTTP/1.1 200 OK

{
"access_token": "30074489E5A32B59BA6D680B607E28B",
"token_type": "Bearer"
}

Proxyclick API using php code

class Proxyclick {
public $headers = '';
// set url
public $url = '';

//all fields array
public $fields = array();

function __construct () {
// $this->headers = array('Content-Type: application/x-www-form-urlencoded');
// HERE set headers statick if you want it
}

// PHP functions to curl call
function call () {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->fields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
curl_close($ch);

return json_decode($output, true); // return here php array with stripe api response
}
}

$proxyclick = new Proxyclick();
$proxyclick->url = 'https://api.proxyclick.com/oauth/token';

$proxyclick->headers = array('Content-Type: application/x-www-form-urlencoded');

// set proxyclick fields value
$proxyclick->fields['client_id'] = 'FBC595DE859f526G2C1FEAB16A9';
$proxyclick->fields['client_secret'] = 'FBC595DE859f526G2C1FEAB16A9';
$proxyclick->fields['grant_type'] = 'password';
$proxyclick->fields['username'] = 'example@email.com';
$proxyclick->fields['password'] = 'password';

$proxyclick = $proxyclick->call();

Hope this code and post will helped you for implement Proxyclick API using php . if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org

Exit mobile version