2016-10-31 50 views
0

我有一个类似https://mypdf.pdf的远程PDF,我想发送到其他服务。使用Guzzle上传PDF 6

我狂饮代码:

$responseClient = $this->clientGuzzle->request(
       'POST', "url", [ 
       'multipart' => [ 
        [ 
         'name' => $name, 
         'filename' => $name, 
         'contents' => fopen($pdf,'rb'), 
         'headers' => [ 
          'Content-Type' => 'application/pdf', 
          'Content-Transfer-Encoding' => "binary", 
         ] 
        ], 
       ], 
      ] 
); 

fopen是假的。

+0

链接中的PDF是否存在?是否启用了allow_url_fopen?有没有通知或警告? – Finwe

回答

1

如果fopen返回false那么这个问题与Guzzle无关。检查您的文件和权限。