![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2006
Posts: 16
Rep Power: 0
![]() |
Problem with include
I've installed an apache server on my computer so I can learn and run some php.
I'm trying the following : <?php
/**
*
*
* @version $Id$
* @copyright 2006
*/
echo "test one<br>";
include "sample.shtml";
//include ("http://www.google.com/index.html");
?>and I get: Warning: Failed opening 'http://www.google.com/index.html' for inclusion (include_path='.;C:/phpdev/php/includes;C:/phpdev/php/class') in c:\phpdev\www\index.php on line 12 It seems it won't include anything from the web. What could be the problem? Thanks. |
|
|
|
|
|
#2 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Aug 2005
Posts: 12
Rep Power: 0
![]() |
Friendly as usual I see.
I understand what include does. The problem is that my php version doesn't support what I'm doing. Thanks for everything |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Why are you using two user names? Have you read the forum's rules/FAQ? I will say that if you understand what "include" does, and you're trying to include Google's web-resident index page, you aren't paying any attention to yourself. That doesn't bode well for the outside help. Your php version may not support what you're trying to do, but it didn't promise to tie your shoes and cater to your every dream. It, like most other software, recalcitrantly insists that you play by its rules.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 | ||
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
Quote:
Thus, including sites that you do not control is not a very good idea. |
||
|
|
|
|
|
#6 |
|
Newbie
Join Date: Aug 2005
Posts: 12
Rep Power: 0
![]() |
I was just trying something. I know including google doesn't look so good.
Thanks guys. About the 2 users, I logged in from different computers and turns out one of them remembered a user I forgot existed. |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0
![]() |
Is this include() function a potential security risk? I mean I've had php errors before that have displayed something such as my database password, could someone include a php file and potentially see any of the information between <?php .... ?>s ?
__________________
Don't wound what you can't kill |
|
|
|
|
|
#8 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 769
Rep Power: 3
![]() |
I don't think it would be a risk, as they would be including your file (most likely) through HTTP, so you server would evaluate whatever the PHP was, and send the result (e.g. the HTML) and their page would then just be including the HTML. I'm pretty sure that's how it would go... :o
|
|
|
|
|
|
#9 |
|
Newbie
Join Date: Aug 2006
Posts: 11
Rep Power: 0
![]() |
Jimbo is right, PHP will process all external PHP files (meaning OUT SIDE of your server) and THEN give the result to the file that is including them. So there is NO risk in including google or anyone else’s page. (at lest in the PHP code that is :p)
If you want to learn more about PHP's include function I wrote a lesson on it at: learnphpfree.com - PHP Include |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| having problem with data not saving to a file | codylee270 | C++ | 5 | Apr 13th, 2006 8:39 PM |
| Dev-C++ - #include .cpp/.h files | Cache | C++ | 5 | Nov 25th, 2005 12:34 PM |
| Help! I have a problem | thomas55 | C++ | 1 | Apr 24th, 2005 2:16 PM |
| Problem with #include <linux/sched.h> | linusoft | C++ | 1 | Mar 28th, 2005 4:13 AM |
| string problem when passing in linked list | quantz | C++ | 0 | Feb 27th, 2005 11:11 AM |