fopen() problem

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

    fopen() problem

    Hi,

    Can anyone tell me why going to

    yields results, while the same page retrieved with fopen() says 'no
    results'?

    <?php
    $pageurl='http://www.algaebase.o rg/DistributionRes ponse.lasso?cur rentMethod=dist ro&sk=20&-session=abv3:D5 C1E5F111d2e0504 0XVy1A0A54A';
    $exthandle = fopen($pageurl, "r");
    $content = file($pageurl);
    fclose($exthand le);
    echo(implode("" ,$content));
    ?>

    Thanks
    Piet

  • Erwin Moller

    #2
    Re: fopen() problem

    pieterprovoost@ gmail.com wrote:
    Hi,
    >
    Can anyone tell me why going to
    >
    http://www.algaebase.org/Distributio...5040XVy1A0A54A
    yields results, while the same page retrieved with fopen() says 'no
    results'?
    >
    <?php
    >
    $pageurl='http://www.algaebase.o rg/DistributionRes ponse.lasso?cur rentMethod=dist ro&sk=20&-session=abv3:D5 C1E5F111d2e0504 0XVy1A0A54A';
    $exthandle = fopen($pageurl, "r");
    $content = file($pageurl);
    fclose($exthand le);
    echo(implode("" ,$content));
    ?>
    >
    Thanks
    Piet
    Hi,

    Open the same URL with Wget or something similar.
    That way you can see the response.
    Maybe it is redirecting?

    Regards,
    Erwin Moller

    Comment

    • Jerry Stuckle

      #3
      Re: fopen() problem

      pieterprovoost@ gmail.com wrote:
      Hi,
      >
      Can anyone tell me why going to

      yields results, while the same page retrieved with fopen() says 'no
      results'?
      >
      <?php
      $pageurl='http://www.algaebase.o rg/DistributionRes ponse.lasso?cur rentMethod=dist ro&sk=20&-session=abv3:D5 C1E5F111d2e0504 0XVy1A0A54A';
      $exthandle = fopen($pageurl, "r");
      $content = file($pageurl);
      fclose($exthand le);
      echo(implode("" ,$content));
      ?>
      >
      Thanks
      Piet
      >
      The first one gives me no results, either.

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

      Comment

      • Chung Leong

        #4
        Re: fopen() problem

        pieterprovoost@ gmail.com wrote:
        Hi,
        >
        Can anyone tell me why going to

        yields results, while the same page retrieved with fopen() says 'no
        results'?
        >
        <?php
        $pageurl='http://www.algaebase.o rg/DistributionRes ponse.lasso?cur rentMethod=dist ro&sk=20&-session=abv3:D5 C1E5F111d2e0504 0XVy1A0A54A';
        $exthandle = fopen($pageurl, "r");
        $content = file($pageurl);
        fclose($exthand le);
        echo(implode("" ,$content));
        ?>
        >
        Thanks
        Piet
        This works when the session is fresh:

        <?php

        $pageurl='http://www.algaebase.o rg/DistributionRes ponse.lasso?cur rentMethod=dist ro&sk=0&-session=abv3:80 08664A11d922E7E 0QsT317D415';
        echo file_get_conten ts($pageurl);

        ?>

        Why are you using fopen() and file() and the same time?

        Comment

        • pieterprovoost@gmail.com

          #5
          Re: fopen() problem


          Chung Leong wrote:
          pieterprovoost@ gmail.com wrote:
          Hi,

          Can anyone tell me why going to

          yields results, while the same page retrieved with fopen() says 'no
          results'?

          <?php
          $pageurl='http://www.algaebase.o rg/DistributionRes ponse.lasso?cur rentMethod=dist ro&sk=20&-session=abv3:D5 C1E5F111d2e0504 0XVy1A0A54A';
          $exthandle = fopen($pageurl, "r");
          $content = file($pageurl);
          fclose($exthand le);
          echo(implode("" ,$content));
          ?>

          Thanks
          Piet
          >
          This works when the session is fresh:
          >
          <?php
          >
          $pageurl='http://www.algaebase.o rg/DistributionRes ponse.lasso?cur rentMethod=dist ro&sk=0&-session=abv3:80 08664A11d922E7E 0QsT317D415';
          echo file_get_conten ts($pageurl);
          >
          ?>
          >
          Why are you using fopen() and file() and the same time?
          The code is a bit messy indeed, sorry for that. However, this worked
          very fine before without ever changing the session name...

          Comment

          • Miguel Cruz

            #6
            Re: fopen() problem

            "pieterprovoost @gmail.com" <pieterprovoost @gmail.comwrote :
            Can anyone tell me why going to

            &-session=abv3:D5 C1E5F111d2e0504 0XVy1A0A54A
            yields results, while the same page retrieved with fopen() says 'no
            results'?
            That URL doesn't contain your search terms.

            It contains a reference ("abv3:D5C1E5F1 11d2e05040XVy1A 0A54A") to a
            session stored on the server's hard drive which in turn holds your
            search terms.

            That session has a finite lifespan, and after that (maybe half an hour
            or so) the server throws it away, and the URL becomes invalid.

            If you want this to work and you do not control the algaebase server,
            you are going to have to use curl to build a form submission and collect
            the results. You cannot, to my knowledge do this with fopen(). You could
            do your own HTTP transaction with fsockopen() et al but that would be
            overkill.

            miguel
            --
            Photos from 40 countries on 5 continents: http://travel.u.nu
            Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
            Airports of the world: http://airport.u.nu

            Comment

            Working...