Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

parsing $HTTP_RAW_POST_DATA????

Posted on 2004-04-18
3
Medium Priority
?
887 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

604 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