Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
how do I get the html string?
Old 04-27-2008, 03:36 AM how do I get the html string?
Webmaster Talker

Posts: 626
Trades: 0
I have downloaded the Prince.php class which converts an html/xhtml/xml file into a PDF. It works perfectly as I have done it from the command line without a problem.

The method that I used to do it in the command line was:
Code:
# php index.php > index.xml
# prince index.xml
this creates a file called index.pdf and it works perfectly.

Now... I tried running:

Code:
system('php index.php > index.xml');
This created the xml file but did NOT put the contents of the file into it.

So... I am calling index.php using POST to get some variables into it from a form. I then dynamically determine the output of the page using the value of those variables. Now I need to somehow get the XHTML stream from what is displayed in the browser and send it to the prince method that I'm calling to convert the xml stream to PDF.

I hope this made sense. Any ideas?
jim.thornton is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-28-2008, 11:00 PM Re: how do I get the html string?
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
First question is, can you pipe input through to prince? E.g.,

# php index.php | prince > index.pdf
or to display:
# php index.php | prince

Not sure why what you did doesn't work, I usually do my CLI stuff in Perl.

From http://us.php.net/system :
"If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends."

Just curious if maybe you attempted to read the index.xml file before the program finished? Have you tried just using backticks (``) or shell_exec?
__________________
Chris Duerr
AddonChat Java Chat Software

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Old 05-01-2008, 11:46 AM Re: how do I get the html string?
Webmaster Talker

Posts: 626
Trades: 0
No I didn't try it... But I got it working thank you.

I ended up using ob_start() and just saving the output to a variable and then I didn't have to use file handling at all. I just called the price function to convert a string to pdf.

Thanks for the help though!
jim.thornton is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to how do I get the html string?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.63163 seconds with 12 queries