how to 'implode' a URL ??

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

    how to 'implode' a URL ??

    hi,

    using PHP 4.3.3 and Apache (ADVX) 2.0.47 and i want to get the contents of
    my SETI stats site :

    $personal = implode("",
    @file("http://setiathome.ssl. berkeley.edu/fcgi-bin/fcgi?email=$ema il&cmd=user_sta ts_new"));

    which gives me this :

    Warning: implode(): Bad arguments. in
    /home/rob/www/php/phpMySetiStats/download.php on line 4

    what am i doing wrong ? i used this code a couple of months back on somewhat
    older versions of PHP/Apache in Windows2000 and it worked ... ??
  • Guest's Avatar

    #2
    Re: how to 'implode' a URL ??


    "Rob" <unknown@anonym ous.net> wrote in message
    news:vtv3l893ap ap95@corp.super news.com...[color=blue]
    > hi,
    >
    > using PHP 4.3.3 and Apache (ADVX) 2.0.47 and i want to get the contents of
    > my SETI stats site :
    >
    > $personal = implode("",
    >[/color]
    @file("http://setiathome.ssl. berkeley.edu/fcgi-bin/fcgi?email=$ema il&cmd=use
    r_stats_new"));[color=blue]
    >
    > which gives me this :
    >
    > Warning: implode(): Bad arguments. in
    > /home/rob/www/php/phpMySetiStats/download.php on line 4
    >
    > what am i doing wrong ? i used this code a couple of months back on[/color]
    somewhat[color=blue]
    > older versions of PHP/Apache in Windows2000 and it worked ... ??[/color]

    Or

    you could just read it from

    $SETI_DIRECTORY/user_info.sah
    ......
    nresults=8505





    Comment

    • Andy Hassall

      #3
      Re: how to 'implode' a URL ??

      On Wed, 17 Dec 2003 00:03:19 +0100, Rob <unknown@anonym ous.net> wrote:
      [color=blue]
      >using PHP 4.3.3 and Apache (ADVX) 2.0.47 and i want to get the contents of
      >my SETI stats site :
      >
      >$personal = implode("",
      >@file("http://setiathome.ssl. berkeley.edu/fcgi-bin/fcgi?email=$ema il&cmd=user_sta ts_new"));
      >
      >which gives me this :
      >
      >Warning: implode(): Bad arguments. in
      >/home/rob/www/php/phpMySetiStats/download.php on line 4
      >
      >what am i doing wrong ? i used this code a couple of months back on somewhat
      >older versions of PHP/Apache in Windows2000 and it worked ... ??[/color]

      You've suppressed warnings with @, and you're using the return value from
      file() directly. So there's two easy places you can help yourself:

      (a) Remove the @, and look at any warning produced.
      (b) Execute the file() separately and use var_dump to examine what it returns.

      Read the manual page, and what file() can return: http://uk2.php.net/file
      Which of the two possible return types could give a problem with implode()?

      And anyway - if you're on 4.3, you may as well use file_get_conten ts().

      --
      Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
      Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

      Comment

      • Rob

        #4
        Re: how to 'implode' a URL ??

        Andy Hassall wrote:
        [color=blue]
        > You've suppressed warnings with @, and you're using the return value from
        > file() directly.[/color]

        ah, ok ... now i get this (e-mail edited!) :

        Warning: file(): php_network_get addresses: getaddrinfo failed: Temporary
        failure in name resolution in /home/rob/www/php/phpMySetiStats/download.php
        on line 7

        Warning: file(http://...@<my email>&cmd=user _stats_new): failed to open
        stream: Resource temporarily unavailable in
        /home/rob/www/php/phpMySetiStats/download.php on line 7

        but using the URL directly from Mozilla gives me the stats page, so it is
        there and available.
        [color=blue]
        > And anyway - if you're on 4.3, you may as well use file_get_conten ts().[/color]

        ok.
        btw ; in this case it gives the same error :

        Warning: file_get_conten ts(): php_network_get addresses: getaddrinfo failed:
        Temporary failure in name resolution in
        /home/rob/www/php/phpMySetiStats/download.php on line 8

        so there's probably something wrong with the way i supply the URL ...
        i'll keep trying ;-)




        Comment

        • Shawn Wilson

          #5
          Re: how to 'implode' a URL ??

          Rob wrote:[color=blue]
          >
          > Andy Hassall wrote:
          >[color=green]
          > > You've suppressed warnings with @, and you're using the return value from
          > > file() directly.[/color]
          >
          > ah, ok ... now i get this (e-mail edited!) :
          >
          > Warning: file(): php_network_get addresses: getaddrinfo failed: Temporary
          > failure in name resolution in /home/rob/www/php/phpMySetiStats/download.php
          > on line 7
          >
          > Warning: file(http://...@<my email>&cmd=user _stats_new): failed to open
          > stream: Resource temporarily unavailable in
          > /home/rob/www/php/phpMySetiStats/download.php on line 7
          >
          > but using the URL directly from Mozilla gives me the stats page, so it is
          > there and available.
          >[color=green]
          > > And anyway - if you're on 4.3, you may as well use file_get_conten ts().[/color]
          >
          > ok.
          > btw ; in this case it gives the same error :
          >
          > Warning: file_get_conten ts(): php_network_get addresses: getaddrinfo failed:
          > Temporary failure in name resolution in
          > /home/rob/www/php/phpMySetiStats/download.php on line 8
          >
          > so there's probably something wrong with the way i supply the URL ...
          > i'll keep trying ;-)[/color]

          You may want to urlencode() the $email address. If that doesn't work, maybe the
          site uses a redirect or something? If so try fsockopen().

          Regards,
          Shawn
          --
          Shawn Wilson
          shawn@glassgian t.com

          Comment

          • CountScubula

            #6
            Re: how to 'implode' a URL ??

            Use a sniffer/packet capture, type the url into a browser, and watch
            the header info, this could help you debug.

            as was said, you may need to use a socket, then supply a cookie or
            useragent or something.

            There was a time when I had a page accessing an https document on
            wellsfargos website, and then they restricted access to specific user
            agents (netscape and ie only) so i used a socket and wrote the agent
            header.


            Mike Bradley
            http://gzen.myhq.info -- free online php tools

            Comment

            • CountScubula

              #7
              Re: how to 'implode' a URL ??

              Ok, me again

              I wrote a small utility that you can use, if you using a windows 2000,
              or xp (i have not tested on others)

              This little program will let you watch the header exchage between your
              browser and your server.

              You just tell your browser to use a proxy/sock server at
              127.0.0.1:8080 and your ready to go (be sure to remove the proxy/sock
              setting from your browser when your done with the program or you will
              be wondering why you cant surf)

              You can find it here: http://gzen.myhq.info/sockview.php



              Mike Bradley
              http://gzen.myhq.info -- free online php tools

              Comment

              Working...