how to process result from other servers?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • leo

    how to process result from other servers?

    babelfish provides online translation service

    if clicking one of my links containing:


    all the following pages will contain the http://babelfish.altavista.com

    i wonder if PHP is able to retrieve the translation result.

    Thanks for your help.


  • Joshie Surber

    #2
    Re: how to process result from other servers?

    use fread() (http://us3.php.net/manual/en/function.fread.php) to save
    the results of the page to a variable, then use a regexp or the such to
    process out any cruft you don't want.

    leo wrote:[color=blue]
    > babelfish provides online translation service
    >
    > if clicking one of my links containing:
    > http://babelfish.altavista.com/babel...ypage.show.php
    >
    > all the following pages will contain the http://babelfish.altavista.com
    >
    > i wonder if PHP is able to retrieve the translation result.
    >
    > Thanks for your help.[/color]

    Comment

    • leo

      #3
      Re: how to process result from other servers?


      "Joshie Surber" <joshiesurber@g mail.com> wrote in message
      news:1146023017 .419668.180330@ g10g2000cwb.goo glegroups.com.. .[color=blue]
      > use fread() (http://us3.php.net/manual/en/function.fread.php) to save
      > the results of the page to a variable, then use a regexp or the such to
      > process out any cruft you don't want.
      >[/color]

      the problem falls on:

      1) w/o javascript onclick function, how to embed the redirect header() into
      a single click on text or icon? otherwise, infinite looping results...

      2) once finished processing the result and write to a file, say,
      result.php, but if my umask is not to allow execute by default (should not
      change due to security concern), how then execute the result.php (need to be
      php in order to ensure all the php functions containing in it to be usable)?




      Comment

      • Jerry Stuckle

        #4
        Re: how to process result from other servers?

        leo wrote:[color=blue]
        > "Joshie Surber" <joshiesurber@g mail.com> wrote in message
        > news:1146023017 .419668.180330@ g10g2000cwb.goo glegroups.com.. .
        >[color=green]
        >>use fread() (http://us3.php.net/manual/en/function.fread.php) to save
        >>the results of the page to a variable, then use a regexp or the such to
        >>process out any cruft you don't want.
        >>[/color]
        >
        >
        > the problem falls on:
        >
        > 1) w/o javascript onclick function, how to embed the redirect header() into
        > a single click on text or icon? otherwise, infinite looping results...
        >
        > 2) once finished processing the result and write to a file, say,
        > result.php, but if my umask is not to allow execute by default (should not
        > change due to security concern), how then execute the result.php (need to be
        > php in order to ensure all the php functions containing in it to be usable)?
        >
        >
        >
        >[/color]

        If you have a link to another site, then yes, any link clicked on at that site
        will contain that sites link. That's how things are supposed to work. You're
        clicking on thiner link, after all. Can you imaging what could happen if a site
        could "capture" your browser?

        First of all, you can't do it with a redirect. The redirect will never get back
        to your script, so you won't be able to get the results.

        As Joshie indicated, use fread() to get the page from babelfish. This allows
        you to retrieve the page into a variable then do whatever you want with it -
        massage it, display it, etc.

        BTW - if you're looking to use babelfish as a cheap interpreter for your pages,
        don't. Get someone who's a native speaker of that language to translate it for
        you. If you don't understand what I mean, try translating one of your pages (or
        even this post) to another language - then translate the results back.

        The above paragraph, translated to French then back to English, comes out as:

        BTW - if you look at to employ the babelfish as a cheap interpreter for your
        pages, not. Obtain somebody which has a naturalness of this language to
        translate it for you. If you do not include/understand what I want to say, the
        test the translation of your pages (or even of this post) to another language -
        translate the results then behind.


        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • leo

          #5
          Re: how to process result from other servers?


          "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
          news:5oudncHPgs JYwtLZ4p2dnA@co mcast.com...[color=blue]
          > leo wrote:[color=green]
          >> "Joshie Surber" <joshiesurber@g mail.com> wrote in message
          >> news:1146023017 .419668.180330@ g10g2000cwb.goo glegroups.com.. .
          >>[color=darkred]
          >>>use fread() (http://us3.php.net/manual/en/function.fread.php) to save
          >>>the results of the page to a variable, then use a regexp or the such to
          >>>process out any cruft you don't want.
          >>>[/color]
          >> the problem falls on:
          >>
          >> 1) w/o javascript onclick function, how to embed the redirect header()
          >> into a single click on text or icon? otherwise, infinite looping
          >> results...
          >>
          >> 2) once finished processing the result and write to a file, say,
          >> result.php, but if my umask is not to allow execute by default (should
          >> not change due to security concern), how then execute the result.php
          >> (need to be php in order to ensure all the php functions containing in it
          >> to be usable)?
          >>[/color]
          > If you have a link to another site, then yes, any link clicked on at that
          > site will contain that sites link. That's how things are supposed to
          > work. You're clicking on thiner link, after all. Can you imaging what
          > could happen if a site could "capture" your browser?
          >
          > First of all, you can't do it with a redirect. The redirect will never
          > get back to your script, so you won't be able to get the results.
          >
          > As Joshie indicated, use fread() to get the page from babelfish. This
          > allows you to retrieve the page into a variable then do whatever you want
          > with it - massage it, display it, etc.[/color]

          redirect to a PHP generated by me. e.g. http://mypage/show.php contains a
          statement:
          header(Location : http://mypage/result.php);

          so as long as result.php contains all the stuff I want, i remain dominant.
          the problem still falls on that i don't know how to instruct to selectively
          redirect (except javascript onclick).
          [color=blue]
          > BTW - if you're looking to use babelfish as a cheap interpreter for your
          > pages, don't. Get someone who's a native speaker of that language to
          > translate it for you. If you don't understand what I mean, try
          > translating one of your pages (or even this post) to another language -
          > then translate the results back.
          >
          > The above paragraph, translated to French then back to English, comes out
          > as:
          >
          > BTW - if you look at to employ the babelfish as a cheap interpreter for
          > your pages, not. Obtain somebody which has a naturalness of this language
          > to translate it for you. If you do not include/understand what I want to
          > say, the test the translation of your pages (or even of this post) to
          > another language - translate the results then behind.
          >[/color]

          i do agree with you that computer translation needs improvement, but as long
          as my website is mainly composed of organized words - which the translation
          result in this special case performs very well. What the dilemma i need to
          confront with is that:

          if i use babelfish, it will add babelfish site in each of the links. while
          it is okay with static link, for that with php will fail.

          e.g.



          as i implement session, it is likely my server can't recognize the request
          is originally sent by my client.

          if i use fread and process the results, the problem is i need to memorize
          the previous state of translation, perform the php function first and then
          use redirect to the result page but in translated version.

          maybe php does allow that, but studying sams php & mysql 3rd edition doesn't
          give me hints (i wish i'm not overlooking).

          Thanks for all your help!


          Comment

          • Jerry Stuckle

            #6
            Re: how to process result from other servers?

            leo wrote:[color=blue]
            > "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
            > news:5oudncHPgs JYwtLZ4p2dnA@co mcast.com...
            >
            >
            >
            > redirect to a PHP generated by me. e.g. http://mypage/show.php contains a
            > statement:
            > header(Location : http://mypage/result.php);
            >
            > so as long as result.php contains all the stuff I want, i remain dominant.
            > the problem still falls on that i don't know how to instruct to selectively
            > redirect (except javascript onclick).
            >[/color]

            Of course - you're redirecting to your own site, and you control the links on
            that page. But you want to redirect to a different site, yet still retain
            control. You can't do it.

            Once the browser goes to the other site, nothing except operator intervention
            will bring it back to your site!
            [color=blue]
            >
            >
            >
            > i do agree with you that computer translation needs improvement, but as long
            > as my website is mainly composed of organized words - which the translation
            > result in this special case performs very well. What the dilemma i need to
            > confront with is that:
            >[/color]

            Are you sure? For instance - are you sure there are no confusing phrases in
            the translated text?

            Nowadays it is very easy to find a native speaker who will translate pages for
            you for little or no cost. And the result is much more professional looking
            than anything you get from a mechanical translator. Every time I see a page
            translated into poor English I know read "CHEAP!"
            [color=blue]
            > if i use babelfish, it will add babelfish site in each of the links. while
            > it is okay with static link, for that with php will fail.
            >
            > e.g.
            >
            > http://babelfish.altavista.com/babel...3fnew%3dOKF001
            >
            > as i implement session, it is likely my server can't recognize the request
            > is originally sent by my client.
            >
            > if i use fread and process the results, the problem is i need to memorize
            > the previous state of translation, perform the php function first and then
            > use redirect to the result page but in translated version.
            >
            > maybe php does allow that, but studying sams php & mysql 3rd edition doesn't
            > give me hints (i wish i'm not overlooking).
            >
            > Thanks for all your help!
            >
            >[/color]

            But the redirect isn't sent by YOUR client. It's sent by the browser. When the
            user clicks on the link, their browser goes directly to babelfish. Your site
            isn't even involved. So your server won't recognize the request - because it
            never gets there.

            The bottom line is - if you redirect to another site, that site is now in
            control. Your site isn't involved any longer. And nothing YOUR server does can
            change that.

            That's why Joshie suggested fread(). It's the right way to do it.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            Working...