include "http:" failed to open stream: problem

Discussion in 'PHP' started by anna.sobiepanek, Apr 18, 2007.

  1. #1
    Hi i have a php page that when it is submitted it does some stuff and then in an 'if' block does the following:
    include "http://127.0.0.1/paragon/client_hist.php?aid=$agent_ID";

    when i run this i get an error:
    Warning: include(http://127.0.0.1/paragon/client_hist.php) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 401 Access Denied in C:\Inetpub\wwwroot\paragon\account_save.php on line 69

    Warning: include() [function.include]: Failed opening 'http://127.0.0.1/paragon/client_hist.php' for inclusion (include_path='.:/usr/local/lib/php') in C:\Inetpub\wwwroot\paragon\account_save.php on line 69

    However if i run it just like
    include"client_hist.php";
    it works and goes to the page i need.

    However I need to pass a variable to the next page!!!
    and if i do
    include"client_hist.php?aid=$agent_ID"
    I get an error:
    Warning: include(client_hist.php?cid=33) [function.include]: failed to open stream: Invalid argument in C:\Inetpub\wwwroot\paragon\account_save.php on line 69

    Warning: include() [function.include]: Failed opening 'client_hist.php?cid=33' for inclusion (include_path='.:/usr/local/lib/php') in C:\Inetpub\wwwroot\paragon\account_save.php on line 69

    I guess its looking for the exact file name including ?cid=33 ???

    I am not sure whats happening with this stuff:
    my php.ini includes the following:
    safe_mode = Off
    safe_mode_gid = Off
    safe_mode_include_dir = Off
    include_path = ".:/usr/local/lib/php" #read this somewhere don't know why??tried others
    file_uploads = On
    allow_url_fopen = On
    allow_url_include = On

    I don't know what else u need to know just help!
     
    anna.sobiepanek, Apr 18, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Try:

    
    $_GET['aid'] = $agent_ID; // or $_GET['cid'] ??
    
    include 'client_hist.php';
    
    PHP:
     
    nico_swd, Apr 18, 2007 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    The above (by nico) would work fine.

    You can also use the absolute url to your website:

    
    include('http://SERVERID/~username/pagetoinclude.php');
    
    PHP:
    Which will only work if your server can recognize it is from the same server.

    Peace,
     
    Barti1987, Apr 18, 2007 IP