I tried to write include "http://".$_SERVER["SERVER_NAME"]."/lol.php" and it didn't include it?

Recommended Answers

All 4 Replies

If you are trying to include from the root directory of your site, use:

include $_SERVER['DOCUMENT_ROOT']."/lol.php";

Yes it can, just a guess here, but it might be a typo, the semicolons are missing at the end of the statement.

For further reference:
Include

If you are trying to include from the root directory of your site, use:

include $_SERVER['DOCUMENT_ROOT']."/lol.php";

Hmm.. That didn't seem the work, it's probably because I'm on a subdomain?

Oh I see what's going on! It isn't grabbing the code because SERVER_NAME is using the full path! But I can't use DOCUMENT_ROOT =\

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.