urgent: Need help to read file

Discussion in 'PHP' started by c4cyber, Sep 29, 2011.

  1. #1
    Hi! I need to read file(A.php) using file_get_contents function.

    A.php contains
    --------------------------------------
    <?php
    echo 'text inside php code block';
    ?>
    text outside php code block
    ----------------------------------

    Now when I do this...

    $opts=array('http'=>array('method'=>'post', 'header'=>'Content-Type:text/html'));
    $context=stream_context_create($opts);
    echo file_get_contents('A.php', true, $context);

    I get

    text outside php code block

    why it doesn't return the whole file contents?
    Am I missing something in header=>Content-Type etc?


    Basically I need to read whole file's content via 'file_get_contents' function.
    Plz don't suggest fread etc.
    Thanks in advance.
     
    c4cyber, Sep 29, 2011 IP
  2. Rashmi Kamani

    Rashmi Kamani Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hi,
    i think you should refer w3schools.com for getting complete and thorough help on PHP as i completed my whole project with the help of this tutorial.
     
    Rashmi Kamani, Sep 29, 2011 IP