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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • typingcat@gmail.com

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

    My application checks for updates by accessing a php page on my
    website. Like the following;


    Now I have created a new checking page like the following;


    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?ver sion=1.0 is requested,
    ------------
    WebRequest req=WebRequest. Create("..../newchecker/checker.php?" +
    "ver=" + Request["version"] +
    "&name=UNKNOWN" );
    WebResponse=req .GetResponse();
    StreamReader sr = new StreamReader(Re sponse.GetRespo nseStream());
    String Output=sr.ReadT oEnd();
    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.

  • Kim André Akerø

    #2
    Re: How to print(other php page's output)?

    typingcat@gmail .com wrote:
    [color=blue]
    > 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?ver sion=1.0 is requested,
    > ------------
    > WebRequest req=WebRequest. Create("..../newchecker/checker.php?" +
    > "ver=" + Request["version"] +
    > "&name=UNKNOWN" );
    > WebResponse=req .GetResponse();
    > StreamReader sr = new StreamReader(Re sponse.GetRespo nseStream());
    > String Output=sr.ReadT oEnd();
    > 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.[/color]

    oldchecker/check.php:

    <?php

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

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

    ?>


    --
    Kim André Akerø
    - kimandre@NOSPAM betadome.com
    (remove NOSPAM to contact me directly)

    Comment

    • typingcat@gmail.com

      #3
      Re: How to print(other php page's output)?

      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:[color=blue]
      > typingcat@gmail .com wrote:
      >[color=green]
      > > 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?ver sion=1.0 is requested,
      > > ------------
      > > WebRequest req=WebRequest. Create("..../newchecker/checker.php?" +
      > > "ver=" + Request["version"] +
      > > "&name=UNKNOWN" );
      > > WebResponse=req .GetResponse();
      > > StreamReader sr = new StreamReader(Re sponse.GetRespo nseStream());
      > > String Output=sr.ReadT oEnd();
      > > 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.[/color]
      >
      > oldchecker/check.php:
      >
      > <?php
      >
      > $scripturl = "http://example.com/newchecker/check.php";
      >
      > header("Locatio n:
      > ".$scripturl."? ver=".$_GET["version"]."&name=UNKNOWN ");
      >
      > ?>
      >
      >
      > --
      > Kim André Akerø
      > - kimandre@NOSPAM betadome.com
      > (remove NOSPAM to contact me directly)[/color]

      Comment

      • Kim André Akerø

        #4
        Re: How to print(other php page's output)?

        typingcat@gmail .com wrote:
        [color=blue]
        > 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?[/color]

        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($script url."?ver=".$_G ET["version"]."&name=UNKNOWN ");

        ?>

        --
        Kim André Akerø
        - kimandre@NOSPAM betadome.com
        (remove NOSPAM to contact me directly)

        Comment

        Working...