SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP to java servlet communiction for PDF streaming

    Hi,

    I have a java servlet that reads the PDF file from the file system and writes to the ServletOutputStream . My requirement is to post to the servlet and read the response from the servlet and display the PDF in the browser. Can you suggest how it can be done in PHP?

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,217
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    This would be done via a socket connection ie: using fsockopen. Once you post the data using headers, use fgets() to read the data.

    Strip the response headers to get your binary stream.

    After than, write headers in PHP stating you are outputting a PDF form using the header function which will then invoke Adobe Reader on the user's machine to show the PDF.

    Matt


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •