lib/recurly/client.php
public function getPdf($uri, $locale = null)
  {
    if (substr($uri,0,4) != 'http')
      $uri = $this->baseUri() . $uri;

    $this->_verifyUri($uri);

    if (is_null($locale))
      $locale = $this->_acceptLanguage;

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $uri);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
    curl_setopt($ch, CURLOPT_HEADER, FALSE); // do not return headers
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      'Accept: application/pdf',
      Recurly_Client::__userAgent(),
      'Accept-Language: ' . $locale,
      'X-Api-Version: ' . Recurly_Client::$apiVersion
    ));
    curl_setopt($ch, CURLOPT_USERPWD, $this->apiKey());

    $response = curl_exec($ch);

    if ($response === false)
    {
      $errorNumber = curl_errno($ch);
      $message = curl_error($ch);
      curl_close($ch);
      $this->_raiseCurlError($errorNumber, $message);
    }

    curl_close($ch);

    return $response;
  }
public function getPdf($uri, $locale = null)
  {
    if (substr($uri,0,4) != 'http')
      $uri = $this->baseUri() . $uri;

    $this->_verifyUri($uri);

    if (is_null($locale))
      $locale = $this->_acceptLanguage;

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $uri);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
    curl_setopt($ch, CURLOPT_HEADER, FALSE); // do not return headers
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      'Accept: application/pdf',
      Recurly_Client::__userAgent(),
      'Accept-Language: ' . $locale,
      'X-Api-Version: ' . Recurly_Client::$apiVersion
    ));
    curl_setopt($ch, CURLOPT_USERPWD, $this->apiKey());

    $response = curl_exec($ch);

    if ($response === false)
    {
      $errorNumber = curl_errno($ch);
      $message = curl_error($ch);
      curl_close($ch);
      $this->_raiseCurlError($errorNumber, $message);
    }

    curl_close($ch);

    return $response;
  }
public function getPdf ( $ uri , $ locale = null ) { if ( substr ( $ uri , 0 , 4 ) != 'http' ) $ uri = $ this -> baseUri ( ) . $ uri ; $ this -> _verifyUri ( $ uri ) ; if ( is_null ( $ locale ) ) $ locale = $ this -> _acceptLanguage ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ uri ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , TRUE ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , 2 ) ; curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , FALSE ) ; curl_setopt ( $ ch , CURLOPT_MAXREDIRS , 1 ) ; curl_setopt ( $ ch , CURLOPT_HEADER , FALSE ) ; // do not return headers curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , TRUE ) ; curl_setopt ( $ ch , CURLOPT_CONNECTTIMEOUT , 10 ) ; curl_setopt ( $ ch , CURLOPT_TIMEOUT , 15 ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , array ( 'Accept: application/pdf' , Recurly_Client :: __userAgent ( ) , 'Accept-Language: ' . $ locale , 'X-Api-Version: ' . Recurly_Client :: $ apiVersion ) ) ; curl_setopt ( $ ch , CURLOPT_USERPWD , $ this -> apiKey ( ) ) ; $ response = curl_exec ( $ ch ) ; if ( $ response === false ) { $ errorNumber = curl_errno ( $ ch ) ; $ message = curl_error ( $ ch ) ; curl_close ( $ ch ) ; $ this -> _raiseCurlError ( $ errorNumber , $ message ) ; } curl_close ( $ ch ) ; return $ response ; }
Requests a PDF document from the given URI

@param  string $uri      Target URI for this request (relative to the API root)
@param  string $locale   Locale for the PDF invoice (e.g. "en-GB", "en-US", "fr")
@return string $response PDF document
@throws Recurly_Error
Requests a PDF document from the given URI