Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I include or require a PHP file?

Status
Not open for further replies.

NeckBone

Programmer
Oct 15, 2003
47
US
Hi Folks,
I'm a newbie to PHP, I have a C++ background and am trying to get started with PHP. I'm also trying to use the GPL browser detector at apptools.com/phptools/browser/source.php

I've been practicing with it loaded on Apache Server with PHP 4 installed but not getting anywhere.

I'm not sure about how to call it from a web page to include the file.

Could you please help me out with a hint on how to include the file into a web page?

Thanks,
NeckBone

For every problem, there's a solution and every solution brings it's own set of problems.
 
include() or require(), if that's what you are looking for.

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
If you copy the source file "browser.php" (the one you mention) to the directory your PHP source is in then the (minimal/sample) code should look like this:

Code:
<?php
require_once("browser.php");
$br = new Browser;
echo "$br->Platform, $br->Name version $br->Version";
?>

Regards


Jakob :)
 
Thanks guys,
I appreciate it.

For every problem, there's a solution and every solution brings it's own set of problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top