?
Solved

parsing $HTTP_RAW_POST_DATA????

Posted on 2004-04-18
3
Medium Priority
?
875 Views
Last Modified: 2012-06-22
Ok this may be really basic for you gurus.  
I have my form script working well, Thanks!!!
I would like to parse the pot data and use it to name the temp file.
Heres the peice of script Im useing:
$tmpfname = tempnam("/tmp", "tmp_");
$tmpfname .= ".fdf";
$fptr = fopen("$tmpfname", "w");
fputs($fptr, $HTTP_RAW_POST_DATA);
fclose($fptr);

This is the Data that gets sent from Acrobat:
%FDF-1.2
%âãÏÓ
1 0 obj<</FDF<</F(/E/Sites/worldtraveldoctor/test.pdf)/ID[<3052e91251426183a1255e1805a2501f><d114c6a103ad2c439a6efc0fb5bc3912>]/Fields[<</T(lastname)/V(Smith)>><</T(firstname)/V(Bill)>>]>>>>
endobj
trailer
<</Root 1 0 R>>
%%EOF


I would like to take lastname field and the firstname field and add it as the prefix of the temp file name.  
so instead of
$tmpfname = tempnam("/tmp", "tmp_");

It should be
$tmpfname = tempnam("/tmp", "$lastname_$firstname_");  //or something like that

So the file name would be Smith_Bill_uniquefilename.fdf
0
Comment
Question by:livegirllove
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 2000 total points
ID: 10855105
If you have FDF Toolkit installed.. then you can do this easily...

For example

<?php

   $fdffp = fopen("test.fdf", "w");
   fwrite($fdffp, $HTTP_RAW_POST_DATA, strlen($HTTP_RAW_POST_DATA));
   fclose($fdffp);

   $fdf = fdf_open("test.fdf");
   $firstname = fdf_get_value($fdf, "firstname");
   echo "firstname = $firstname \n";

   $lastname = fdf_get_value($fdf, "lastname");
   echo "lastname = $lastname \n";
   fdf_close($fdf);

 // $tmpfname = tempnam("/tmp", "tmp_");
  $filename = "$lastname_$firstname_test.fdf"
   $fdffp = fopen($filename, "w");
   fwrite($fdffp, $HTTP_RAW_POST_DATA, strlen($HTTP_RAW_POST_DATA));
   fclose($fdffp);
    // OR you can simple rename test.fdf to $lastname_$firstname_test.fdf
?>


Check this link for more details..
http://www.phpbuilder.com/columns/uwe20001116.php3?aid=154&print_mode=1
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10855108

FDF toolkit can be downloaded from
http://partners.adobe.com/asn/acrobat/forms.jsp
0
 
LVL 1

Author Comment

by:livegirllove
ID: 10855515
thanks, I was trying to avoid installing the tool kit, but Ill look into it then get back to this post.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

741 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