470,848 Members | 1,610 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

How to print(other php page's output)?

My application checks for updates by accessing a php page on my
website. Like the following;
http://myserver.com/oldchecker/check.php?version=1.0

Now I have created a new checking page like the following;
http://myserver.com/newchecker/check...=1.0&name=user

Because there still are users who are using old versions, I need to
keep the old checker but I would like to use the new checker's result
in the old checker. I mean, I want to do something like

if ...oldchecker/checker.php?version=1.0 is requested,
------------
WebRequest req=WebRequest.Create("..../newchecker/checker.php?" +
"ver=" + Request["version"] +
"&name=UNKNOWN");
WebResponse=req.GetResponse();
StreamReader sr = new StreamReader(Response.GetResponseStream());
String Output=sr.ReadToEnd();
Response.Write(Output);
--------

I'm more familiar with C# so I wrote it in C#, but I guess you have
figured out what I'm trying to do.

Oct 24 '05 #1
3 1481
ty*******@gmail.com wrote:
My application checks for updates by accessing a php page on my
website. Like the following;
http://myserver.com/oldchecker/check.php?version=1.0

Now I have created a new checking page like the following;
http://myserver.com/newchecker/check...=1.0&name=user

Because there still are users who are using old versions, I need to
keep the old checker but I would like to use the new checker's result
in the old checker. I mean, I want to do something like

if ...oldchecker/checker.php?version=1.0 is requested,
------------
WebRequest req=WebRequest.Create("..../newchecker/checker.php?" +
"ver=" + Request["version"] +
"&name=UNKNOWN");
WebResponse=req.GetResponse();
StreamReader sr = new StreamReader(Response.GetResponseStream());
String Output=sr.ReadToEnd();
Response.Write(Output);
--------

I'm more familiar with C# so I wrote it in C#, but I guess you have
figured out what I'm trying to do.


oldchecker/check.php:

<?php

$scripturl = "http://example.com/newchecker/check.php";

header("Location:
".$scripturl."?ver=".$_GET["version"]."&name=UNKNOWN");

?>
--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Oct 24 '05 #2
Thank you Kim Andre Akero,
but I guess that is only good when the page is viewed by a web browser?

My application doesn't lauch a web browser for the checker page, but
just connect to the web, and download the web page string, and shows it
in a message box. Isn't there any other way to do this?

Kim André Akerĝ wrote:
ty*******@gmail.com wrote:
My application checks for updates by accessing a php page on my
website. Like the following;
http://myserver.com/oldchecker/check.php?version=1.0

Now I have created a new checking page like the following;
http://myserver.com/newchecker/check...=1.0&name=user

Because there still are users who are using old versions, I need to
keep the old checker but I would like to use the new checker's result
in the old checker. I mean, I want to do something like

if ...oldchecker/checker.php?version=1.0 is requested,
------------
WebRequest req=WebRequest.Create("..../newchecker/checker.php?" +
"ver=" + Request["version"] +
"&name=UNKNOWN");
WebResponse=req.GetResponse();
StreamReader sr = new StreamReader(Response.GetResponseStream());
String Output=sr.ReadToEnd();
Response.Write(Output);
--------

I'm more familiar with C# so I wrote it in C#, but I guess you have
figured out what I'm trying to do.


oldchecker/check.php:

<?php

$scripturl = "http://example.com/newchecker/check.php";

header("Location:
".$scripturl."?ver=".$_GET["version"]."&name=UNKNOWN");

?>
--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)


Oct 24 '05 #3
ty*******@gmail.com wrote:
Thank you Kim Andre Akero,
but I guess that is only good when the page is viewed by a web
browser?

My application doesn't lauch a web browser for the checker page, but
just connect to the web, and download the web page string, and shows
it in a message box. Isn't there any other way to do this?


Hopefully, your PHP installation is configured with URL fopen wrappers,
making this method applicable:

oldchecker/check.php:
<?php

$scripturl = "http://example.com/newchecker/check.php";

include($scripturl."?ver=".$_GET["version"]."&name=UNKNOWN");

?>

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Oct 24 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Brian Keanie | last post: by
1 post views Thread by Christian H | last post: by
3 posts views Thread by hartbypass | last post: by
5 posts views Thread by carlor | last post: by
5 posts views Thread by Erik | last post: by
4 posts views Thread by Peter | last post: by
2 posts views Thread by nikou_70 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.