Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php file() fail to open stream error

    i use same code in 2 different version of php

    Code:
    <?php
        echo "<pre>";
        $b = file('http://localhost:8080');
        print_r($b);
    ?>

    php 5.0.2 return me no error message

    Code:
    Array
    (
        [0] => 
    
        [1] => 
    
        [2] => 
    
        [3] =>     "http://www.w3.org/TR/html4/loose.dtd">
    
        [5] => 
    
        [6] => 
    
        [7] =>     
    
        [8] =>         
    
        [9] =>         
    
        [10] =>     
    
        [11] =>     
    
        [12] =>         Hello World!
    
        [13] =>     
    
        [14] => 
    
    )

    However php 5.2.6 return me error message

    Code:
    Warning:  file(http://localhost:8080/) [function.file]: failed to open stream: No such file or directory in /export/home/test1.php on line 3

    any advice how can i solve the problem?

  • #2
    Regular Coder hinch's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Posts
    923
    Thanks
    25
    Thanked 80 Times in 80 Posts
    try

    $fp = @fopen("http://localhost:8080","r");
    print_r($fp);
    A programmer is just a tool which converts caffeine into code

    My work: http://www.fcsoftware.co.uk && http://www.firstcontactcrm.com
    My hobby: http://www.angel-computers.co.uk
    My life: http://www.furious-angels.com

  • #3
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it return

    Code:
    Warning:  fopen(http://localhost:8080) [function.fopen]: failed to open stream: No such file or directory in /export/home/test.php on line 6
    Looks like fopen failed too. :S

  • #4
    Regular Coder hinch's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Posts
    923
    Thanks
    25
    Thanked 80 Times in 80 Posts
    odd don't really have any other suggestions sorry
    A programmer is just a tool which converts caffeine into code

    My work: http://www.fcsoftware.co.uk && http://www.firstcontactcrm.com
    My hobby: http://www.angel-computers.co.uk
    My life: http://www.furious-angels.com

  • #5
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by hinch View Post
    odd don't really have any other suggestions sorry
    there is nothing odd and @ don't make anything then hidding error messages

    Quote Originally Posted by ldaves View Post
    i use same code in 2 different version of php
    Code:
    <?php
        echo "<pre>";
        $b = file('http://localhost:8080');
        print_r($b);
    ?>
    php 5.0.2 return me no error message

    However php 5.2.6 return me error message

    Code:
    Warning:  file(http://localhost:8080/) [function.file]: failed to open stream: No such file or directory in /export/home/test1.php on line 3

    any advice how can i solve the problem?
    http://www.php.net/manual/en/function.fopen.php

    http://www.php.net/manual/en/filesys...llow-url-fopen

    regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •