Solved

parsing $HTTP_RAW_POST_DATA????

Posted on 2004-04-18
3
858 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
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mysql between clause 2 24
AWS EC2 & RDS Instance 5 35
Loop through multiple arrays 13 28
how to use 2 SELECT statements with prepared statements 19 30
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…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

777 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