file_get_contents outputs nothing

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

    #1

    file_get_contents outputs nothing

    Hi everyone,

    The output of

    echo file_get_conten ts("http://watchout4snakes .com/creativitytools/
    RandomWord/RandomWordPlus. aspx");

    leaves the browser empty.. no error messages, nothing.

    Why is this occurring?

    Thanks

    Taras

  • Good Man

    #2
    Re: file_get_conten ts outputs nothing

    Taras_96 <taras.di@gmail .comwrote in news:1193323567 .561939.158410
    @y27g2000pre.go oglegroups.com:
    Hi everyone,
    >
    The output of
    >
    echo file_get_conten ts("http://watchout4snakes .com/creativitytools/
    RandomWord/RandomWordPlus. aspx");
    >
    leaves the browser empty.. no error messages, nothing.
    >
    Why is this occurring?
    presumably you have an error somewhere and error_reporting is set to off.

    Comment

    • Taras_96

      #3
      Re: file_get_conten ts outputs nothing

      On Oct 25, 11:40 pm, Good Man <he...@letsgo.c omwrote:
      Taras_96 <taras...@gmail .comwrote in news:1193323567 .561939.158410
      @y27g2000pre.go oglegroups.com:
      >
      Hi everyone,
      >
      The output of
      >
      echo file_get_conten ts("http://watchout4snakes .com/creativitytools/
      RandomWord/RandomWordPlus. aspx");
      >
      leaves the browser empty.. no error messages, nothing.
      >
      Why is this occurring?
      >
      presumably you have an error somewhere and error_reporting is set to off.
      >From my php.ini
      error_reporting = E_ALL|E_STRICT

      ; Print out errors (as a part of the output). For production web
      sites,
      ; you're strongly encouraged to turn this feature off, and use error
      logging
      ; instead (see below). Keeping display_errors enabled on a production
      web site
      ; may reveal security information to end users, such as file paths on
      your Web
      ; server, your database schema or other information.
      display_errors = On


      Comment

      • Good Man

        #4
        Re: file_get_conten ts outputs nothing

        Taras_96 <taras.di@gmail .comwrote in
        news:1193338184 .455469.86540@k 35g2000prh.goog legroups.com:
        On Oct 25, 11:40 pm, Good Man <he...@letsgo.c omwrote:
        >Taras_96 <taras...@gmail .comwrote in news:1193323567 .561939.158410
        >@y27g2000pre.g ooglegroups.com :
        >>
        Hi everyone,
        >>
        The output of
        >>
        echo file_get_conten ts("http://watchout4snakes .com/creativitytools/
        RandomWord/RandomWordPlus. aspx");
        >>
        leaves the browser empty.. no error messages, nothing.
        >>
        Why is this occurring?
        This is on the manual page for file_get_conten ts, is this why? do you have
        fopen wrappers enabled?


        You can use a URL as a filename with this function if the fopen wrappers
        have been enabled. See fopen() for more details on how to specify the
        filename and Appendix O, List of Supported Protocols/Wrappers for a list of
        supported URL protocols.






        Comment

        • Rik Wasmus

          #5
          Re: file_get_conten ts outputs nothing

          On Thu, 25 Oct 2007 16:46:07 +0200, Taras_96 <taras.di@gmail .comwrote:
          Hi everyone,
          >
          The output of
          >
          echo file_get_conten ts("http://watchout4snakes .com/creativitytools/
          RandomWord/RandomWordPlus. aspx");
          >
          leaves the browser empty.. no error messages, nothing.
          >
          Why is this occurring?
          It's a badly designed website/server, which apparently applies browser
          sniffing of some sort. You'll have to mimique a common UA with for
          instance CURL to get it to output anything. This works:

          <?php
          $ch = curl_init();

          curl_setopt($ch , CURLOPT_URL,
          "http://watchout4snakes .com/creativitytools/RandomWord/RandomWordPlus. aspx");
          curl_setopt($ch ,CURLOPT_USERAG ENT,'Mozilla/5.0 (Windows; U; Windows NT
          5.2; en-GB; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7');

          curl_exec($ch);
          curl_close($ch) ;
          ?>

          ... without setting the CURLOPT_USERAGE NT the site indeed outputs nothing..
          --
          Rik Wasmus

          Comment

          • macca

            #6
            Re: file_get_conten ts outputs nothing

            Okay I just tried this with readfile.


            $path = 'http://watchout4snakes .com/creativitytools/RandomWord/
            RandomWordPlus. aspx';

            echo readfile($path) ;


            Now, readfile returns the number of bytes read from the file or false
            on failure and this outputs '0'.

            This leads me to believe that the problem is something to do with the
            aspx page not the php code.

            Comment

            • Taras_96

              #7
              Re: file_get_conten ts outputs nothing

              On Oct 26, 3:02 am, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
              On Thu, 25 Oct 2007 16:46:07 +0200, Taras_96 <taras...@gmail .comwrote:
              Hi everyone,
              >
              The output of
              >
              echo file_get_conten ts("http://watchout4snakes .com/creativitytools/
              RandomWord/RandomWordPlus. aspx");
              >
              leaves the browser empty.. no error messages, nothing.
              >
              Why is this occurring?
              >
              It's a badly designed website/server, which apparently applies browser
              sniffing of some sort. You'll have to mimique a common UA with for
              instance CURL to get it to output anything. This works:
              >
              <?php
              $ch = curl_init();
              >
              curl_setopt($ch , CURLOPT_URL,
              "http://watchout4snakes .com/creativitytools/RandomWord/RandomWordPlus. ...");
              curl_setopt($ch ,CURLOPT_USERAG ENT,'Mozilla/5.0 (Windows; U; Windows NT
              5.2; en-GB; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7');
              >
              curl_exec($ch);
              curl_close($ch) ;
              ?>
              >
              .. without setting the CURLOPT_USERAGE NT the site indeed outputs nothing.
              --
              Rik Wasmus
              Yep, that would do the trick :D

              Thanks all for your suggestions

              Taras

              Comment

              Working...