/    Sign up×
Community /Pin to ProfileBookmark

Hello all,

I’m in a slightly ridiculous situation and hope someone can point me in the right direction.

I have a canned function from a PHP script that I can’t edit directly that displays HTML to the browser.

Unfortunately, the function doesn’t also return the string of everything it’s sending to the browser, but that’s precisely what I need: all of the tags and text its showing. (It doesn’t matter whether the resulting page actually shows up or not, as this entire script is just for the purpose of writing what it spits out to a static .html file.)

Is there any way to “capture” the text the function call displays in PHP4?

I was thinking that one possible method would be to somehow look at the client-side source that PHP has processed at the end of the script itself. Is there any way to view your own source?

Or better yet, does anyone have any knowledge that might help me out?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@justin1754authorFeb 18.2005 — Just solved my own problem using this (in case anyone is looking for this sort of thing):

$string = file_get_contents("http://localhost/script.php");

Just put the offending function in a one or two line separate file and have the primary script call it so it can just pull out the string. (Note that in order for the script to execute, you have to use the http:// construction, local folder calls won't do it.)
×

Success!

Help @justin1754 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...