NYCPHP Meetup

NYPHP.org

[nycphp-talk] need another pair of eyes!

Kristina Anderson ka at kacomputerconsulting.com
Wed Jul 23 18:11:20 EDT 2008


Hi Tim -- is there any way to get it to work by submitting the form 
twice and then including the file with the headers/pdf content?

thanks.

> So why not approach it like this:
> 
> 	1) Redirect back from paypal.  Display whatever text you need.
> 	2) Include in that page a good ole "Your download should start  
> momentarily, if not, <a ...>click here</a>
> 	3) Include a hidden iframe pointing at an empty page
> 	4) Include a hidden form that targets the iframe
> 	5) Use javascript to trigger to form submit
> 	6) Whatever the form-handler script is, I'm assuming it's the 
bit  
> that outputs some headers and then emits the PDF content.
> 
> This seems to be close to what you're trying to do, but with the  
> addition of the iframe.
> 
> -Tim
> 
> On Jul 23, 2008, at 3:52 PM, Kristina Anderson wrote:
> 
> > The situation is this...the full app needs to
> >
> > 1.  upon redirection from Paypal, display some text on an HTML page,
> >
> > 2.  post some data that is passed to the download page, and
> >
> > 3.  serve up a file for download.
> >
> > In order for me to use headers to serve up the file, I have to 
pass  
> > the
> > data on the transation to another page after I render the HTML.  
There
> > is database validation stuff which is stripped out for this sample 
but
> > which is working in the original code.
> >
> >
> >
> > Thanks!
> >
> >> Not entirely clear on what you're trying to accomplish.  Can you
> > give
> >> us some context, maybe tell us a user story?
> >>
> >> -Tim
> >>
> >> On Jul 23, 2008, at 3:28 PM, Kristina Anderson wrote:
> >>
> >>> Hi everyone, I really need another pair of eyes to take a look at
> >>> this.  I'm pretty sure this form needs to be submitted twice in
> > order
> >>> to pass the post array to the included file (see code below)...is
> > that
> >>> the only issue here..?  this is a bare bones code sample which i
> > will
> >>> have to integrate into my paypal app.
> >>>
> >>> the code modification was prompted by the fact that the buyers
> > were
> >>> not
> >>> seeing an html page on my client's website before the download box
> >>> popped up, and this needs to be rectified.
> >>>
> >>> Thanks in advance!
> >>>
> >>> FILE 1 - testdowndisp.php
> >>> <?
> >>>
> >>> $itemno = "333";
> >>>
> >>> ?>
> >>>
> >>> <html>
> >>> <head>
> >>> <script language="javascript">
> >>>
> >>> var flag = true;
> >>>
> >>> function laLoad(){
> >>>
> >>> if (flag) {
> >>>
> >>> document.fred.submit();
> >>> //var flag = false;
> >>>
> >>> }
> >>>
> >>> }
> >>>
> >>> </script>
> >>>
> >>> </head>
> >>>
> >>> <body onload="laLoad()">
> >>> Thanks for your purchase.  The charge will appear on your 
statement
> > as
> >>> Rough Draft P.<p>Welcome back to Proof Magazine website.
> >>>
> >>> <form name="fred" action="testdowndisp.php" method="POST">
> >>> <input type="hidden" name="transid" value="<? echo $tx ?>">
> >>> <input type="hidden" name="pdfid" value="<? echo $itemno ?>">
> >>> </form>
> >>> <?
> >>>
> >>> ob_clean();
> >>> include('downloadfile2.php');
> >>> //exit(0);
> >>>
> >>> ?>
> >>> </body>
> >>> </html>
> >>>
> >>>
> >>> FILE 2 -- downloadfile2.php
> >>>
> >>> <?
> >>>
> >>> $pdfid = $_POST['pdfid'];
> >>> $filename = $pdfid.".pdf";
> >>> //echo $pdfid."<br>";
> >>> //echo $filename."<br>";
> >>>
> >>>
> >>> //====
> >>> $path = '/usr431/home/p/r/proof/PDFs/';
> >>> $filesize=filesize($path.$filename);
> >>> header("Content-Type: application/pdf");
> >>>     header("Content-Length: ".$filesize);
> >>>     header("Content-Disposition: attachment; filename=$filename");
> >>>     header("Content-Transfer-Encoding: binary");
> >>> readfile($path.$filename);
> >>> //fopen($path.$filename);
> >>> //===
> >>>
> >>> ?>
> >>>
> >>>
> >>> -- Kristina_______________________________________________
> >>> New York PHP Community Talk Mailing List
> >>> http://lists.nyphp.org/mailman/listinfo/talk
> >>>
> >>> NYPHPCon 2006 Presentations Online
> >>> http://www.nyphpcon.com
> >>>
> >>> Show Your Participation in New York PHP
> >>> http://www.nyphp.org/show_participation.php
> >>
> >> _______________________________________________
> >> New York PHP Community Talk Mailing List
> >> http://lists.nyphp.org/mailman/listinfo/talk
> >>
> >> NYPHPCon 2006 Presentations Online
> >> http://www.nyphpcon.com
> >>
> >> Show Your Participation in New York PHP
> >> http://www.nyphp.org/show_participation.php
> >>
> >>
> >
> >
> > _______________________________________________
> > New York PHP Community Talk Mailing List
> > http://lists.nyphp.org/mailman/listinfo/talk
> >
> > NYPHPCon 2006 Presentations Online
> > http://www.nyphpcon.com
> >
> > Show Your Participation in New York PHP
> > http://www.nyphp.org/show_participation.php
> 
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
> 
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
> 
> 




More information about the talk mailing list