Page 1 of 1

Parsing results from a different php page

Posted: Tue Jun 06, 2006 8:25 am
by andym01480
I have a script that is generating a pdf file using fpdf. It needs to grab the html output from a different script called listing.php, strip out the html and reformat it to insert into the pdf. Bizarrely I think i can work out the processing easily enough, but the grey matter has gone blank on grabbing it from the output of listing.php in the first place!

I have a nudging feeling that a :oops: will be in order after the first reply!

Posted: Tue Jun 06, 2006 8:29 am
by SpiderMonkey
I recall a long time ago I did HTML requests from php.

I'll look up what I did and post it if noone else knows this.

edit: Hmmm, apparantly last time I did in ASP not php :oops:

Regardless, I think this is what you are looking for:

http://uk2.php.net/manual/en/function.fsockopen.php

Connect to the server hosting the php page and you can treat its output like a file.

Posted: Tue Jun 06, 2006 8:52 am
by andym01480
On the support forum for the calendar software I was using, it has been suggested to use ob_start and ob_get_contents

Code: Select all

<?php

ob_start();
include ("listing.php");
$output = ob_get_contents();
ob_end_clean();

//process $output blah blah
?>
Will give it a try and come back!

[SOLVED] Parsing results from a different php page

Posted: Tue Jun 06, 2006 8:55 am
by andym01480
Hallelujah! It works, now to work out how to process it!