In our forums we have a customizable syntax highlighter which you can change the theme of when viewing code. When you want to share with us a code and are using the code tags it will automatically make it look beautiful!
Just a little preview below
Just a little preview below
- Code:
$client_id = "[your client id]";
$client_secret = "[your client secret]";
$oauth_base = "https://secure.viadeo.com/oauth-provider";
$api_base = "https://api.viadeo.com";
$authorize_url = $oauth_base . "/authorize2";
$token_url = $oauth_base . "/access_token2";
$access_token = null;
$opts = Array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HEADER => TRUE,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'viadeo-api-sample-php-agent',
CURLOPT_HTTPHEADER => array("Accept: application/json; charset=UTF-8")
);
if (isset($_REQUEST["error"])) {
echo "Authentication failed : " . $_REQUEST['error_description'];
} else if (isset($_REQUEST["code"])) {
# Request for an access_token
$params = Array(
'grant_type' => 'authorization_code',
'client_id' => $client_id,
'client_secret' => $client_secret,
'redirect_uri' => curPageURL(),
'code' => $_REQUEST["code"]
);
$result = _http('POST', '', $params, $token_url);
# Record access token and make requests
if ($result) {
$access_token = $result->access_token;
make_requests(); # See below for a sample make_requests()
}
} else {
$params['response_type'] = 'code';
$params['client_id'] = $client_id;
$params['redirect_uri'] = curPageURL();
$url = $authorize_url . "?" . http_build_query($params, NULL, '&');
header("Location: $url");
}