SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get Contents By Passing Variables

    I want to grab the contents of a file but I need to pass a variable to the file I'm getting the contents from. Here is what I tried but it doesn't work:
    PHP Code:
    $Var "test";
    $Contents file_get_contents("test.php?var=$Var"
    Here is the error I get
    Code:
    Warning:  file_get_contents(test.php?var=test) [function.file-get-contents]: failed to open stream: Invalid argument in ../index.php
    What I would like to know is there a way to achieve this, getting the contents of a file while passing a variable to it. Thanks in advance,
    Matt
    Kayzio - We don't hesitate, we accelerate.

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nvm i figured out a better way of achieving this using includes instead
    Kayzio - We don't hesitate, we accelerate.


Bookmarks

Posting Permissions

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