src/Auth/LeadpagesLogin.php
public function createApiKey()
	{
        if (!isset($this->token)) {
            return false;
        }

        $authHeader = 'LP-Security-Token';
        if (stripos($this->token, 'lp ') === 0) {
            $authHeader = 'Authorization';
        }

        try {
            $response = $this->client->post($this->keyUrl, [
                'headers' => [
                    $authHeader => $this->token,
                    'Content-Type' => 'application/json',
                ],
				'verify' => $this->certFile,
				'body' => json_encode(['label' => 'wordpress-plugin']),
            ]);
            
			$body = json_decode($response->getBody(), true);

            $value = false;
			if (array_key_exists('value', $body)) {
                $value = $body['value'];
			}

        } catch (ClientException $e) {
            // token is bad
            $value = false;

        } catch (ConnectException $e) {
            $value = false;
        }

        return $value;
    }
public function createApiKey()
	{
        if (!isset($this->token)) {
            return false;
        }

        $authHeader = 'LP-Security-Token';
        if (stripos($this->token, 'lp ') === 0) {
            $authHeader = 'Authorization';
        }

        try {
            $response = $this->client->post($this->keyUrl, [
                'headers' => [
                    $authHeader => $this->token,
                    'Content-Type' => 'application/json',
                ],
				'verify' => $this->certFile,
				'body' => json_encode(['label' => 'wordpress-plugin']),
            ]);
            
			$body = json_decode($response->getBody(), true);

            $value = false;
			if (array_key_exists('value', $body)) {
                $value = $body['value'];
			}

        } catch (ClientException $e) {
            // token is bad
            $value = false;

        } catch (ConnectException $e) {
            $value = false;
        }

        return $value;
    }
public function createApiKey ( ) { if ( ! isset ( $ this -> token ) ) { return false ; } $ authHeader = 'LP-Security-Token' ; if ( stripos ( $ this -> token , 'lp ' ) === 0 ) { $ authHeader = 'Authorization' ; } try { $ response = $ this -> client -> post ( $ this -> keyUrl , [ 'headers' => [ $ authHeader => $ this -> token , 'Content-Type' => 'application/json' , ] , 'verify' => $ this -> certFile , 'body' => json_encode ( [ 'label' => 'wordpress-plugin' ] ) , ] ) ; $ body = json_decode ( $ response -> getBody ( ) , true ) ; $ value = false ; if ( array_key_exists ( 'value' , $ body ) ) { $ value = $ body [ 'value' ] ; } } catch ( ClientException $ e ) { // token is bad $ value = false ; } catch ( ConnectException $ e ) { $ value = false ; } return $ value ; }
Create an API key for account

@return string|boolean JSON encode key or false
Create an API key for account