header("Location:" . admin_url('admin.php?page=social-media-auto-publish-settings&msg=3')); exit; } } } else { //header("Location:".admin_url('admin.php?page=social-media-auto-publish-settings&msg=2')); //exit(); } if (isset($_POST['lnauth'])) { $redirecturl = admin_url('admin.php?page=social-media-auto-publish-settings&auth=3'); $lnappikey = get_option('xyz_smap_lnapikey'); $lnapisecret = get_option('xyz_smap_lnapisecret'); # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback $API_CONFIG = array('appKey' => $lnappikey, 'appSecret' => $lnapisecret, 'callbackUrl' => $redirecturl); $OBJ_linkedin = new SMAPLinkedIn($API_CONFIG); $response = $OBJ_linkedin->retrieveTokenRequest(); if (isset($response['error'])) { header("Location:" . admin_url('admin.php?page=social-media-auto-publish-settings&msg=1')); exit; } $lnoathtoken = $response['linkedin']['oauth_token']; $lnoathseret = $response['linkedin']['oauth_token_secret']; # Now we retrieve a request token. It will be set as $linkedin->request_token update_option('xyz_smap_lnoauth_token', $lnoathtoken); update_option('xyz_smap_lnoauth_secret', $lnoathseret); wp_redirect(SMAPLinkedIn::_URL_AUTH . $response['linkedin']['oauth_token']); echo "<script>document.location.href='" . SMAPLinkedIn::_URL_AUTH . $response['linkedin']['oauth_token'] . "'</script>"; die; } if (isset($_GET['auth']) && $_GET['auth'] == 3) { if (isset($_GET['auth_problem'])) {