Re: Download remote PDF using php code
Stephen Pynenburg <[email protected]> Thu, 3 Aug 2017 09:18:10 -0400
| Newsgroups | gmane.comp.web.curl.php |
|---|---|
| Message-ID | <CAPgVXYOqQB_Z=egCg+Ayv9d2juqzQ53X_-d_vKuP=MNC9W63GA@mail.gmail.com> |
--===============1470816960== Content-Type: multipart/alternative; boundary="94eb2c05941858634f0555d936c3" --94eb2c05941858634f0555d936c3 Content-Type: text/plain; charset="UTF-8" Hello Nour, Some basic steps to try for debugging: - is the PDF file on disk the same size as expected (i.e. how big is the PDF)? If you are getting a much shorter response than expected, your curl request is not receiving the PDF data and you need to find out why. - what is the HTTP response code? (use curl_getinfo()). Are you missing a redirect? - does the server require some cookies or other state to access the file? - have you looked in the response headers? Is content-length the same as expected? Stephen On Thu, Aug 3, 2017 at 7:59 AM, Nour Omar <[email protected]> wrote: > Hello, > > I don't know, I'm not informed about it. I only used the code that i sent > to you. > Note: my pdf files contain designs (graphics). > Can you please tell me what is missing that my code might work? > > Best regards > Nour > > Sent from my iPhone > > > On Aug 3, 2017, at 12:33 PM, Nima Sadjadi <[email protected]> wrote: > > > > Had you set the header() of your output page correctly? > > > > > > _______________________________________________ > > https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php > > _______________________________________________ > https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php > --94eb2c05941858634f0555d936c3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div><div><div>Hello Nour,<br></div>Some basic steps = to try for debugging:<br>- is the PDF file on disk the same size as expecte= d (i.e. how big is the PDF)? If you are getting a much shorter response tha= n expected, your curl request is not receiving the PDF data and you need to= find out why.<br></div>- what is the HTTP response code? (use curl_getinfo= ()). Are you missing a redirect?<br></div>- does the server require some co= okies or other state to access the file?<br></div>- have you looked in the = response headers? Is content-length the same as expected?<br><div><div><div= ><div><br></div><div>Stephen<br></div></div></div></div></div><div class=3D= "gmail_extra"><br><div class=3D"gmail_quote">On Thu, Aug 3, 2017 at 7:59 AM= , Nour Omar <span dir=3D"ltr"><<a href=3D"mailto:[email protected]= om" target=3D"_blank">[email protected]</a>></span> wrote:<br><b= lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px = #ccc solid;padding-left:1ex">Hello,<br> <br> I don't know, I'm not informed about it. I only used the code that = i sent to you.<br> Note: my pdf files contain designs (graphics).<br> Can you please tell me what is missing that my code might work?<br> <br> Best regards<br> Nour<br> <br> Sent from my iPhone<br> <span class=3D""><br> > On Aug 3, 2017, at 12:33 PM, Nima Sadjadi <<a href=3D"mailto:nsadja= [email protected]">[email protected]</a>> wrote:<br> ><br> > Had you set the header() of your output page correctly?<br> ><br> ><br> </span>> ______________________________<wbr>_________________<br> > <a href=3D"https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php"= rel=3D"noreferrer" target=3D"_blank">https://cool.haxx.se/cgi-bin/<wbr>mai= lman/listinfo/curl-and-php</a><br> <br> ______________________________<wbr>_________________<br> <a href=3D"https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php" rel= =3D"noreferrer" target=3D"_blank">https://cool.haxx.se/cgi-bin/<wbr>mailman= /listinfo/curl-and-php</a><br> </blockquote></div><br></div> --94eb2c05941858634f0555d936c3-- --===============1470816960== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KaHR0cHM6Ly9j b29sLmhheHguc2UvY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL2N1cmwtYW5kLXBocAo= --===============1470816960==--