Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerating PDF between 2 sites
    primarykey
    data
    text
    <p>I'm standing infront of a crossroad full of potential ways to solve my problem. My problem is that I want to refer specific users to a unique page that renders relevant PDF file for them. Preferably, I want to refer them to one site, which the relevant MySQL-data and plugin for pdf rendering isn't on. Hopefully, you can shed some light to which solution I should use.</p> <p><strong>Reference</strong></p> <ul> <li><strong>Site A</strong> - The site I prefer to refer them to be on</li> <li><strong>Site B</strong> - The site containing the MySQL data and PDF plugin</li> </ul> <p><strong>Info</strong></p> <ul> <li>Both sites are built through CakePHP 1.3</li> <li>Site A currently doesn't have a database attached to it. It simply runs on API calls only to Site B.</li> <li>These PDFs won't be that heavy to generate, though it would be interesting to find a solution which also accounts for this</li> <li>The reference to these PDFs occurs upon events, and are not sent to thousands of users at the same time.</li> </ul> <h1>Solution #1</h1> <p>Refer them to Site B and generate everything there. </p> <p><strong>Pros:</strong> Easy to fix.<br> <strong>Cons:</strong> I don't want these users to know of Site B. Site B is intended mostly for internal communication, and would be best let out of this for given users.<br> <strong>Thoughs:</strong> Rather avoid this one.</p> <h1>Solution #2</h1> <p>Have a page on Site A that <a href="http://php.net/manual/en/book.curl.php" rel="nofollow">cURLs</a> a page equal to Solution #1, and then outputs the same result. </p> <p><strong>Pros:</strong> Pretty much equal easy to fix.<br> <strong>Cons:</strong> Can't think of any.<br> <strong>Thoughs:</strong> Will the browser understand that I output a PDF? Or do I (if possible) copy headers reply from cURL request and set them in own <code>header()</code> before output?</p> <h1>Solution #3</h1> <p>Generate the PDF once in Site B and place it on Site A. Then simply refer to the .pdf link. </p> <p><strong>Pros:</strong> Faster loading. Not that it matters in this case and might even go unnoticed.<br> <strong>Cons:</strong> Can't as easily modify the PDF output.<br> <strong>Thoughs:</strong> How would I transfer the file? The 2 sites are on the same server, so it would be possible with a simply path change, however all other communication between the sites are made to that they don't need to share servers. Shame to break that design. Maybe I would have to do an advanced cURL request and send the pdf file as a POST from Site B to Site A and upload it? Doesn't seem as neat solution either, though.</p> <h1>Solution #4</h1> <p>Run an API from Site A to Site B to get relevant data based on ID from url. But also have the PDF plugin on Site A aswell. </p> <p><strong>Pros:</strong> In one way, quite a logical approach.<br> <strong>Cons:</strong> I would prefer to have all PDF generating on Site B only. Makes it easier to manage all of them.<br> <strong>Thoughs:</strong> I'm a bit unsure how much (if any) more beneficial this approach would be compared to Solution 2.</p> <p>Many thanks for your time. Please motivate one of given solutions, or present your own one.</p> <p><strong>EDIT:</strong> Although code samples always are appreciated, I'm more interrested in the resoning and logic to why which one of the solutions, or an other, should be used. I already know how to solve most of these solution through coding. For visitors, feel free to link to relevant functions and methods regarding your reply.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload