public function getSinglePageDownloadUrl($pageId)
    {
        try {
            $response = $this->client->get($this->PagesUrl . '/' . $pageId, [
                'headers' => ['Authorization' => 'Bearer '. $this->login->apiKey],
                'verify' => $this->certFile,
            ]);

            $body = json_decode($response->getBody(), true);
            $url = $body['_meta']['publishUrl'];
            $responseText = ['url' => $url];

            $response = [
                'code' => '200',
                'response' => json_encode($responseText),
                'error' => false
            ];

        } catch (ClientException $e) {
            $httpResponse = $e->getResponse();
            // 404 means their Leadpage in their account probably got deleted
            if ($httpResponse->getStatusCode() == 404) {
                $response = [
                    'code' => $httpResponse->getStatusCode(),
                    'response' => "
                    Your Leadpage could not be found! Please make sure it is published in your Leadpages Account <br />
                    <br />
                    Support Info:<br />
                    <strong>Page id:</strong> {$pageId} <br />
                    <strong>Page url:</strong> {$this->PagesUrl}/{$pageId}",
                    'error' => true
                ];

            } else {
                $message = 'Something went wrong, please contact Leadpages support.';
                $response = $this->parseException($e);
            }

        } catch (ServerException $e) {
            $response = $this->parseException($e);

        } catch (ConnectException $e) {
            $message = 'Can not connect to Leadpages Server:';
            $response = $this->parseException($e, $message);

        } catch (RequestException $e) {
            $response = $this->parseException($e);
        }

        return $response;
    }
public function getSinglePageDownloadUrl($pageId)
    {
        try {
            $response = $this->client->get($this->PagesUrl . '/' . $pageId, [
                'headers' => ['Authorization' => 'Bearer '. $this->login->apiKey],
                'verify' => $this->certFile,
            ]);

            $body = json_decode($response->getBody(), true);
            $url = $body['_meta']['publishUrl'];
            $responseText = ['url' => $url];

            $response = [
                'code' => '200',
                'response' => json_encode($responseText),
                'error' => false
            ];

        } catch (ClientException $e) {
            $httpResponse = $e->getResponse();
            // 404 means their Leadpage in their account probably got deleted
            if ($httpResponse->getStatusCode() == 404) {
                $response = [
                    'code' => $httpResponse->getStatusCode(),
                    'response' => "
                    Your Leadpage could not be found! Please make sure it is published in your Leadpages Account <br />
                    <br />
                    Support Info:<br />
                    <strong>Page id:</strong> {$pageId} <br />
                    <strong>Page url:</strong> {$this->PagesUrl}/{$pageId}",
                    'error' => true
                ];

            } else {
                $message = 'Something went wrong, please contact Leadpages support.';
                $response = $this->parseException($e);
            }

        } catch (ServerException $e) {
            $response = $this->parseException($e);

        } catch (ConnectException $e) {
            $message = 'Can not connect to Leadpages Server:';
            $response = $this->parseException($e, $message);

        } catch (RequestException $e) {
            $response = $this->parseException($e);
        }

        return $response;
    }
public function getSinglePageDownloadUrl ( $ pageId ) { try { $ response = $ this -> client -> get ( $ this -> PagesUrl . '/' . $ pageId , [ 'headers' => [ 'Authorization' => 'Bearer ' . $ this -> login -> apiKey ] , 'verify' => $ this -> certFile , ] ) ; $ body = json_decode ( $ response -> getBody ( ) , true ) ; $ url = $ body [ '_meta' ] [ 'publishUrl' ] ; $ responseText = [ 'url' => $ url ] ; $ response = [ 'code' => '200' , 'response' => json_encode ( $ responseText ) , 'error' => false ] ; } catch ( ClientException $ e ) { $ httpResponse = $ e -> getResponse ( ) ; // 404 means their Leadpage in their account probably got deleted if ( $ httpResponse -> getStatusCode ( ) == 404 ) { $ response = [ 'code' => $ httpResponse -> getStatusCode ( ) , 'response' => "
                    Your Leadpage could not be found! Please make sure it is published in your Leadpages Account <br />
                    <br />
                    Support Info:<br />
                    <strong>Page id:</strong> {$pageId} <br />
                    <strong>Page url:</strong> {$this->PagesUrl}/{$pageId}" , 'error' => true ] ; } else { $ message = 'Something went wrong, please contact Leadpages support.' ; $ response = $ this -> parseException ( $ e ) ; } } catch ( ServerException $ e ) { $ response = $ this -> parseException ( $ e ) ; } catch ( ConnectException $ e ) { $ message = 'Can not connect to Leadpages Server:' ; $ response = $ this -> parseException ( $ e , $ message ) ; } catch ( RequestException $ e ) { $ response = $ this -> parseException ( $ e ) ; } return $ response ; }
Get the url to download the page url from

@param string $pageId

@return array
Get the url to download the page url from