I've got the below warning messages when I use "include" in my script:

Warning: php_hostconnect: connect failed in /home/.sites/143/site2/web/Admin/adminmain.php on line 77

Warning: Failed opening 'http://www.mywebsite.com/Admin/mainchoice/memberinfo.php?subchoice=' for inclusion (include_path='') in /home/.sites/143/site2/web/Admin/adminmain.php on line 77

The code is like that:
$filename = 'http://www.mywebsite.com/Admin/mainchoice/memberinfo.php?subchoice='.$subchoice;
include($filename);

Because my website is hosting by the webhosting company and I can't change the conf of PHP. Would anyone tell me how to solve this problem?

Thanks a lot!!!

    Warning: Failed opening 'http://www.mywebsite.com/Admin/mainchoice/memberinfo.php?subchoice=' for inclusion (include_path='') in /home/.sites/143/site2/web/Admin/adminmain.php on line 77 

    [/b]

    Would it fail if the value for the $subchoice variable weren't null as it seems to be in this example?

      even $subchoice is null or not, it also shows the warning ... 🙁

        I suppose that it is possible they are on an older version of PHP with a Windows server (wouldn't work...) or that URL_fopen_wrappers is not set in their PHP configuration...can you include() a static HTML file using the same method?

          yes ... I can ... I can include any .php file without passing variables ... and the server is Sun Cobalt, running linux and php 4.0.6 ...

            Have you checked the $filename value....echo it out before you call the include, and see if the URL it gives will work in a browser, for example....

              Yo i have the same problem!
              I figured out how to get round it tho:

              Instead of using the "?subchoice=" you put the Variable "$subchoice" before you include, and then you just include the page WITHOUT the Substring...

              This is what i mean:

              <?php
              $filename = "http://www.mywebsite.com/Admin/mainchoice/memberinfo.php";
              $subchoice = "$yourchoice";
              include"$filename";
              

              This works for me, should work for you...

              The include you provided in your first post doesn't work in an Include() function because it this the extension of the filename is .php?subchoice= , and tries to find the filename with that extension... it works in a browser because its looking for the filename memberinfo.php and set the variable "$Subchoice", it knows this because the browser recognises the "?" (question mark", and tell the page that "$subchoice = $youchoice"...

              BTW i DID give u the answer in your PM box...

              14yr and hating school! lol, so i turn to php... 😃

                oh yes ~ got it!!! Thx ... no matter how old you are, I only foucs on who got the knowledge ~ 🙂

                  Write a Reply...