/ Published in: PHP
Bind this particular custom function to a button and name that button as generate your link or any anchor does work, better pass it with a JavaScript's through the action and send the variable or make a ajax call and send it.....or in the action assign it to the php page and call that function then rest u can read from the below code....formatted....
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function Authlin($authcheckin){ $app_id = "YOUR_APP_ID"; $app_secret = "YOUR_APP_SECRET"; $my_url = "YOUR_URL"; $code = $authcheckin; $dialog_url = "http://yourcodeurl.com/dialog/oauth?client_id=" . $_SESSION['state']; echo("<script> top.location.href='" . $dialog_url . "'</script>"); } if($_REQUEST['state'] == $_SESSION['state']) { $token_url = "https://yourcodeurl.com/oauth/access_token?" . "&client_secret=" . $app_secret . "&code=" . $code; $params = null; $graph_url = "https://yourcodeurl.com/me?access_token=" . $params['access_token']; echo("Hello " . $user->name); } else { echo("The state does not match.Access Denied."); } } ?>