Is User Agent Change Possible?

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

    Is User Agent Change Possible?

    I heard PHP hard coded useragent in several places. It sucks, unlike Perl
    which you can enter anything. It is even worse than Wget.

    I wonder if PHP5 allows User Agent changes now, because it seems to add many
    header related functions. But I still did not see one yet.


  • Manuel Lemos

    #2
    Re: Is User Agent Change Possible?

    Hello,

    On 07/21/2004 01:47 AM, Asker wrote:[color=blue]
    > I heard PHP hard coded useragent in several places. It sucks, unlike Perl
    > which you can enter anything. It is even worse than Wget.
    >
    > I wonder if PHP5 allows User Agent changes now, because it seems to add many
    > header related functions. But I still did not see one yet.[/color]

    What do you mean? The user agent is defined by the browser that requests
    the pages. Do you mean when PHP fetches remote pages via fopen()?

    --

    Regards,
    Manuel Lemos

    PHP Classes - Free ready to use OOP components written in PHP
    Free PHP Classes and Objects 2026 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


    PHP Reviews - Reviews of PHP books and other products


    Metastorage - Data object relational mapping layer generator

    Comment

    • Asker

      #3
      Re: Is User Agent Change Possible?

      > What do you mean? The user agent is defined by the browser that requests[color=blue]
      > the pages. Do you mean when PHP fetches remote pages via fopen()?
      >[/color]

      yes, i meant that in fopen


      Comment

      • Anders K. Madsen

        #4
        Re: Is User Agent Change Possible?

        On Wed, 21 Jul 2004 01:15:59 -0400
        "Asker" <news.ispnetbil ling.com@alexa. com> wrote:
        [color=blue][color=green]
        > > What do you mean? The user agent is defined by the browser that
        > > requests the pages. Do you mean when PHP fetches remote pages via
        > > fopen()?
        > >[/color]
        >
        > yes, i meant that in fopen
        >[/color]

        I'm sorry, but why do you even bother?
        I mean, if it really is that important to you, write a wrapper for the
        perl-thingy... Or even better... Grab the latest PHP source and edit it
        yourself...

        Madsen

        --
        Anders K. Madsen --- http://lillesvin.linux.dk

        "There are 10 types of people in the world.
        Those who understand binary - and those who don't."

        -----BEGIN PGP SIGNATURE-----
        Version: GnuPG v1.2.4 (GNU/Linux)

        iD8DBQFA/gKQlNHJe/JASHcRAoxiAJ9up B6xLfgteIoGK1or uu3mw9G7ewCeIgF y
        P16vmVe0Pu+gm/8poZgLzP0=
        =rDZO
        -----END PGP SIGNATURE-----

        Comment

        • Zurab Davitiani

          #5
          Re: Is User Agent Change Possible?

          Asker wrote:
          [color=blue]
          > yes, i meant that in fopen[/color]

          You can set user_agent in php.ini.

          Comment

          • Manuel Lemos

            #6
            Re: Is User Agent Change Possible?

            Hello,

            On 07/21/2004 02:15 AM, Asker wrote:[color=blue][color=green]
            >>What do you mean? The user agent is defined by the browser that requests
            >>the pages. Do you mean when PHP fetches remote pages via fopen()?
            >>[/color]
            >
            >
            > yes, i meant that in fopen[/color]

            In that case you can set it in the php.ini file. If you can't set it in
            the php.ini, you need to fetch the page with fsockopen instead.

            --

            Regards,
            Manuel Lemos

            PHP Classes - Free ready to use OOP components written in PHP
            Free PHP Classes and Objects 2026 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


            PHP Reviews - Reviews of PHP books and other products


            Metastorage - Data object relational mapping layer generator

            Comment

            • Virgil Green

              #7
              Re: Is User Agent Change Possible?

              I haven't investigated, so I'm just going to ask...
              Am I the only one for whom every one of Anders' posts arrives blank with the
              message included in an attachment as a .txt file and his PHP signature
              included as an attachment in a .dat file?

              - Virgil


              Comment

              • Anders K. Madsen

                #8
                Re: Is User Agent Change Possible?

                On Wed, 21 Jul 2004 17:36:39 GMT
                "Virgil Green" <vjg@DESPAMobsy dian.com> wrote:
                [color=blue]
                > I haven't investigated, so I'm just going to ask...
                > Am I the only one for whom every one of Anders' posts arrives blank
                > with the message included in an attachment as a .txt file and his PHP
                > signature included as an attachment in a .dat file?
                >[/color]

                This is indeed odd... 'Cause I think most people don't have any problem
                with it (people on comp.lang.ruby being less forgiving about
                non-standard ways of posting).

                What news-client do you use?

                Oh yeah... PGP signature (not PHP) :) http://gnupg.org

                Madsen

                --
                Anders K. Madsen --- http://lillesvin.linux.dk

                "There are 10 types of people in the world.
                Those who understand binary - and those who don't."

                -----BEGIN PGP SIGNATURE-----
                Version: GnuPG v1.2.4 (GNU/Linux)

                iD8DBQFA/u7blNHJe/JASHcRAoKvAJ45W 3nwqy59tXd+oZyE 4c+jqozeegCeO3V Q
                wi3VxaofVzLrmFF 7B1A3+ak=
                =q7XW
                -----END PGP SIGNATURE-----

                Comment

                • Chung Leong

                  #9
                  Re: Is User Agent Change Possible?

                  "Manuel Lemos" <mlemos@acm.org > wrote in message
                  news:40FE73B9.8 0202@acm.org...[color=blue]
                  > Hello,[color=green]
                  > > On 07/21/2004 02:15 AM, Asker wrote:[color=darkred]
                  > >>What do you mean? The user agent is defined by the browser that requests
                  > >>the pages. Do you mean when PHP fetches remote pages via fopen()?
                  > >>[/color]
                  > >
                  > >
                  > > yes, i meant that in fopen[/color]
                  >
                  > In that case you can set it in the php.ini file. If you can't set it in
                  > the php.ini, you need to fetch the page with fsockopen instead.[/color]

                  Not entirely true. You can change the user agent with ini_set().

                  ini_set('user_a gent', 'Bobo the Clown');

                  With more recent versions of PHP you can also create a stream context for
                  the same purpose:

                  $opts = array(
                  'http'=>array(
                  'method'=>"GET" ,
                  'header'=>"Acce pt-language: en\r\n" .
                  "Cookie: foo=bobo\r\n" .
                  "User-Agent: Bobo the Clown\r\n"
                  )
                  );

                  $context = stream_context_ create($opts);
                  $fp = fopen($url, 'r', false, $context);


                  --
                  Obey the Clown - http://www.conradish.net/bobo/


                  Comment

                  • Virgil Green

                    #10
                    Re: Is User Agent Change Possible?

                    "Anders K. Madsen" <madsen@lillesv in.linux.dk> wrote in message
                    news:2004072200 3152.0122e0a5@l apsvin...[color=blue]
                    > On Wed, 21 Jul 2004 17:36:39 GMT
                    > "Virgil Green" <vjg@DESPAMobsy dian.com> wrote:
                    >[color=green]
                    > > I haven't investigated, so I'm just going to ask...
                    > > Am I the only one for whom every one of Anders' posts arrives blank
                    > > with the message included in an attachment as a .txt file and his PHP
                    > > signature included as an attachment in a .dat file?
                    > >[/color]
                    >
                    > This is indeed odd... 'Cause I think most people don't have any problem
                    > with it (people on comp.lang.ruby being less forgiving about
                    > non-standard ways of posting).
                    >
                    > What news-client do you use?[/color]

                    Outlook Express... you may stop laughing now... ;-)
                    [color=blue]
                    > Oh yeah... PGP signature (not PHP) :) http://gnupg.org[/color]

                    Typo on my part. I meant PGP, but have typed PHP too many times for it not
                    to flow out naturally.

                    - Virgil


                    Comment

                    • Anders K. Madsen

                      #11
                      Re: Is User Agent Change Possible?

                      On Thu, 22 Jul 2004 14:51:44 GMT
                      "Virgil Green" <vjg@DESPAMobsy dian.com> wrote:
                      [color=blue]
                      > "Anders K. Madsen" <madsen@lillesv in.linux.dk> wrote in message
                      > news:2004072200 3152.0122e0a5@l apsvin...[color=green]
                      > > On Wed, 21 Jul 2004 17:36:39 GMT
                      > > "Virgil Green" <vjg@DESPAMobsy dian.com> wrote:
                      > >[color=darkred]
                      > > > I haven't investigated, so I'm just going to ask...
                      > > > Am I the only one for whom every one of Anders' posts arrives
                      > > > blank with the message included in an attachment as a .txt file
                      > > > and his PHP signature included as an attachment in a .dat file?
                      > > >[/color]
                      > >
                      > > This is indeed odd... 'Cause I think most people don't have any
                      > > problem with it (people on comp.lang.ruby being less forgiving about
                      > > non-standard ways of posting).
                      > >
                      > > What news-client do you use?[/color]
                      >
                      > Outlook Express... you may stop laughing now... ;-)
                      >[/color]

                      Ok, I'm done. :-p
                      No, seriously... It's a little weird... I don't know what may cause it,
                      since I've never tried Outlook Express or just Outlook...

                      Does any other Outlook users have a comment here?
                      [color=blue][color=green]
                      > > Oh yeah... PGP signature (not PHP) :) http://gnupg.org[/color]
                      >
                      > Typo on my part. I meant PGP, but have typed PHP too many times for it
                      > not to flow out naturally.[/color]

                      Hehe, I know the feeling. :)

                      Best regards,
                      Madsen

                      --
                      Anders K. Madsen --- http://lillesvin.linux.dk

                      "There are 10 types of people in the world.
                      Those who understand binary - and those who don't."

                      -----BEGIN PGP SIGNATURE-----
                      Version: GnuPG v1.2.4 (GNU/Linux)

                      iD8DBQFA//VLlNHJe/JASHcRAmFDAJ90N bG3Lv7ruCD9IXrT 6LUeRnysvQCcDKN F
                      dKv296KXKmG2mPG 60mb1R8M=
                      =P2a8
                      -----END PGP SIGNATURE-----

                      Comment

                      Working...