file()

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

    file()

    hi all

    $lines = file('http://google.com');
    echo $lines[0];

    it doesn't work, i want to echo the first line, how to?
    thanks
    from Peter (cmk128@hotmail .com)

  • cmk128@hotmail.com

    #2
    Re: file()

    $lines2 = file('http://www.google.com' );
    print_r($lines2 );
    this doesn't work too

    Comment

    • iktorn

      #3
      Re: file()

      cmk128@hotmail. com napisał(a):
      $lines2 = file('http://www.google.com' );
      print_r($lines2 );
      this doesn't work too
      >
      "File" is not the best way to download other page, try curl
      PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

      If you scroll down, class written by Sean Huber can be a good start to
      understand better curl functions.

      Just copy that class and type this
      $c = new CURL();
      print_r($c->get("http://www.google.nl") );


      --
      Wiktor Walc

      Comment

      • Andy Hassall

        #4
        Re: file()

        On 1 Apr 2007 02:07:27 -0700, cmk128@hotmail. com wrote:
        >$lines = file('http://google.com');
        >echo $lines[0];
        >
        >it doesn't work,
        In what way does it not work? It works here:

        andyh@server ~/public_html $ php -q test.php
        <html><head><me ta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1"><title>Googl e</title><style><!--

        Saying "doesn't work" on its own is completely unhelpful; what did you expect?
        What actually happened?
        >i want to echo the first line, how to?
        You just did. Perhaps you want to do something else? Try being more precise;
        first line of what?

        --
        Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
        http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

        Comment

        • cmk128@hotmail.com

          #5
          Re: file()

          On 4月1æ—¥, 下午11時40åˆ †, Andy Hassall <a...@andyh.co. ukwrote:
          On 1 Apr 2007 02:07:27 -0700, cmk...@hotmail. com wrote:
          >
          $lines = file('http://google.com');
          echo $lines[0];
          >
          it doesn't work,
          >
          In what way does it not work? It works here:
          >
          andyh@server ~/public_html $ php -q test.php
          <html><head><me ta http-equiv="content-type" content="text/html;
          charset=ISO-8859-1"><title>Googl e</title><style><!--
          >
          Saying "doesn't work" on its own is completely unhelpful; what did you expect?
          What actually happened?
          >
          i want to echo the first line, how to?
          >
          You just did. Perhaps you want to do something else? Try being more precise;
          first line of what?
          >
          --
          Andy Hassall :: a...@andyh.co.u k ::http://www.andyh.co.ukhttp://www.and....co.uk/space:: disk and FTP usage analysis tool
          thank you

          Comment

          Working...