Include file with variable, like file.php?var=1?

Discussion in 'PHP' started by 123GoToAndPlay, Apr 16, 2008.

  1. #1
    Hi there,

    how can i do something like
    
    include('file.php?var=1');
    
    PHP:
    i tried
    
    include('http://www.mydomain.com/file.php?var=1');
    
    PHP:
    and
    
    $var = "1"
    include('file.php);
    
    PHP:
    with no luck
     
    123GoToAndPlay, Apr 16, 2008 IP
  2. CreativeClans

    CreativeClans Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Numbers 1 and 2 don't work.
    The last one should. Why doesn't it work? What is it that doesn't work? What do you want to achieve with that include?
     
    CreativeClans, Apr 16, 2008 IP
  3. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #3
    improper use of include() function

    include function embeds another page to your parent page..
    on your third example
    make sure you have the right syntax,

    $var = '1';
    include("file.php");
     
    bartolay13, Apr 16, 2008 IP
  4. alemcherry

    alemcherry Guest

    Best Answers:
    0
    #4
    Thrid one should work if you correct the syntax. You should know the theory well, local file include and remote file operation and two differnt things. Trial and error is not the right way, make sure that you understand the basics well.
     
    alemcherry, Apr 16, 2008 IP
  5. dprundle

    dprundle Peon

    Messages:
    399
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #5
    research Curl .. I'm not sure where you're going with this, but curl may help.
     
    dprundle, Apr 16, 2008 IP