Solved

Adobe Acrobat Form Mail Script Acting Strangely

Posted on 2004-05-02
12
375 Views
Last Modified: 2013-12-13
I am using the below PHP script to have my Adobe Acrobat Forms send to me fully completed by the client.  The problem is the redirect page once the script is done ***Header("Location: http://www.sovereignfunding.com/funding/fqty.html"***  hangs for a very long time and often times out.

If you type in http://www.sovereignfunding.com/funding/fqty.html there is never a problem so I am not sure what the issue is.

Looking forward to hearing from someone.

Thanks in advance!

David


==============================================
<?php
// $form_name is provided in the url that calls this page, allowing this page
// to be called from different PDF's, yet customized for each one
$date = (date ("m/d/y"));
$time = (date ("H:i:s T"));
$tmpname = (date ("mdy-His"));

$message = '
This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C37EC6.3F062EA0
Content-Type: text/plain;
    charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

A '.$form_name.' was submitted from the sovereignfunding.com website at '.$time.' on '.$date.'.

(attachment: '.$form_name.')

------=_NextPart_000_0007_01C37EC6.3F062EA0
Content-Type: application/vnd.fdf;
    name="FDF-'.$tmpname.'.fdf"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
    filename="FDF-'.$tmpname.'.fdf"

'.$HTTP_RAW_POST_DATA.'

------=_NextPart_000_0007_01C37EC6.3F062EA0--

';

$recip = "funding_quote@sovereignfunding.com";
$subject = $form_name;
$headers = "From: SMFG <Funding_Quote@SovereignFunding.com>\n";
$headers .= "Return-Path: <Info@SovereignFunding.com>\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"----=_NextPart_000_0007_01C37EC6.3F062EA0\"\n";

$status = mail($recip, $subject, $message, $headers);

Header("Location: http://www.sovereignfunding.com/funding/fqty.html");
?>
==============================================
0
Comment
Question by:d_springer
  • 6
  • 6
12 Comments
 
LVL 2

Expert Comment

by:Warble
Comment Utility
Well, This is a tough one, but perhaps it has to do with your mail() function taking a long time as the script will need to do that before sending the redirect header.

You may try using instead of the mail function, the pear mail class, this way you can switch from SMTP or sendmail methods to see if one works better than the other.

I think on windows, you're restricted to SMTP method anyway, so it may not help in that case.

If you have a Un*x box, you can sniff the connection and see if it hangs before the http location header appears, or after. This would help you distinquish.

If you don't have this tool, you can make the form URL available and I can take a look if you'd like.
0
 

Author Comment

by:d_springer
Comment Utility
Warble,

I am script-stupid so I can tell you this much.

I am on a Linux machine and my form url is here: http://www.sovereignfunding.com/FDFMail.php
A txt version can be found here: http://www.sovereignfunding.com/FDFMail.php.txt

My FormMail script can be found here: http://www.sovereignfunding.com/cgi-bin/FormMail.pl

I am not sure how to "sniff the connection" or what the "the pear mail class" is.

Your guidance in troubleshootting this is greatly appreciated!

David

PS - Where can I find the "tool" you mentioned?
0
 
LVL 2

Expert Comment

by:Warble
Comment Utility
There's a bunch of software out there that can be used for sniffing connections, I use a commandline tool called ngrep, not nessasarily because it's the best, but because I've been pretty successful at using it, and it' fast.. makes sense to me, etc..

You can get it here: http://ngrep.sourceforge.net/

I went to the URL's you gave me and the whole transaction completed in
0.174816 seconds, so no timeout there. I didn't get a form at all, so perhaps the results are different with actual information?

What does the formmail.pl script have to do with this?
0
 

Author Comment

by:d_springer
Comment Utility
To run the application in its entirety you need to start at one of my Adobe Acrobat forms: https://www.sovereignfunding.com/funding/Business_Note.pdf

Once you submit the Adobe Acrobat form at the bottom of the page FDFMail.php is run and this is when the redirect page tends to hang.

The page doesn't hang when you run it directly using http://www.sovereignfunding.com/FDFMail.php although I still receive an email along with a blank Adobe Acrobat attachment.

Re: FormMail.pl I thought when you mentioned "pear mail class" it might have something to do with FormMail.pl.

I went to http://ngrep.sourceforge.net/.  Do I install this directly on my server?  If yes should I install it to the root directory?

Thanks an sorry for all the stupid question etc.

David



0
 
LVL 2

Expert Comment

by:Warble
Comment Utility
Well, I tried the form a couple of times and I never experienced a lag. Took 0.015 secs the second time. You should have the emails with lots of asdf's in them. That's me.

So, if it's not lagging for me, that means the script is okay at least. Maybe something with your unit? Try rebooting, upgrade Acrobat, etc..

Hope that helps. This looks like a tough one.. Try it from a different computer to see if it works.

0
 

Author Comment

by:d_springer
Comment Utility
I got the emails but the attachment said the file was damaged......
0
Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Expert Comment

by:Warble
Comment Utility
Your method of creating the FDF data isn't like anything I've seen. Usually it's a little more structured, but I was figuring you knew something I didn't..

Here's the function I use:

function output_fdf($pdf_file, $pdf_data) {
      header ("Content-Type: application/vnd.fdf");
      $fdf = "%FDF-1.2\n%‚„œ”\n";
      $fdf .= "1 0 obj \n<< /FDF ";
      $fdf .= "<< /Fields [\n";
      
      foreach ($pdf_data as $key => $val) {
      $fdf .= "<< /V ($val)/T ($key) >> \n";
      }
      $fdf .= "]\n/F ($pdf_file) >>";
      $fdf .= ">>\nendobj\ntrailer\n<<\n";
      $fdf .= "/Root 1 0 R \n\n>>\n";
      $fdf .= "%%EOF";
       print $fdf;
}

Use: output_fdf("http://www.yoursite.com/yourpdf.pdf", $data);

Where $data is an array:

$data = array (
      fieldname1 => 'fielddata1',
      fieldname2 => 'fielddata2',
      etc..
}

That may work better as you're just passing the post vars if I remember, I'm not sure that will work.

0
 

Author Comment

by:d_springer
Comment Utility
My website contains many pdf documents each having hundreds of fields. https://www.sovereignfunding.com/funding/fquote.html

The current setup doesn't force me to name the specific documents or fields.

Can you think of a way to delay the redirect page request within the script?

David
0
 
LVL 2

Accepted Solution

by:
Warble earned 500 total points
Comment Utility
Delay it? The sleep function will pause a script's execution: http://us4.php.net/sleep

You might very well have all those fields, but if your current method doesn't work, you gotta do it in a way that does. (I'm assuming it still doesn't work..)

Besides, any array will work, you can call the function like this:

output_fdf("http://www.yoursite.com/yourpdf.pdf", $_POST);

That would call it with all the field names in the previous form.
0
 

Author Comment

by:d_springer
Comment Utility
Warble,

Thanks for all your help.

Can you do me a HUGE favor and change your script so that my current PDF docs located here: https://www.sovereignfunding.com/funding/fquote.html

are emailed to me here: funding_quote@sovereignfunding.com as an attachment.

I am not being lazy I simply don't have a clue when it comes to scripts.  Please include the <?php & ?> & the redirect to http://www.sovereignfunding.com/funding/fqty.html.

I need the script to be idiot proof otherwise I'll be right back here whining that I got some sort of error.

THANK YOU!!!!!!

David
0
 

Author Comment

by:d_springer
Comment Utility
Warble,

I changed

Header("Location: http://www.sovereignfunding.com/funding/fqty.html");

to

header( 'refresh: 1; url=/funding/fqty.html' );

And everything seems to be working fine.

Thanks for your help.

David
0
 
LVL 2

Expert Comment

by:Warble
Comment Utility
Glad you figured it out. I'm going to have to look into your FDF method. Apparently it works, which is news to me. Thanks for teaching me something too!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now