Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Login to the Fidelity service
- function fidelity_login() {
- $url = "https://cat.fidelity.co.uk/gateway/wl/iam/v1/token";
- $data = 'context=login';
- $username = 'test_user';
- $password = 'REDACTED';
- $args = array(
- 'headers' => array(
- 'Content-Type' => 'application/json; charset=utf-8',
- 'Authorization' => 'Basic ' . json_encode( $username . ':' . $password ),
- 'apikey' => 'b005892b-3e28-4732-9d98-4619a44233a0',
- ),
- 'method' => 'POST'
- );
- $result = wp_remote_post($url, $args);
- if( !is_wp_error( $result ) ) {
- print "<pre>";
- print_r($result);
- print "</pre>";
- die();
- } else {
- print "<pre>";
- print_r($result);
- print "</pre>";
- die();
- }
- }
- add_action( 'wp', 'fidelity_login' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement