4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Argh! Include Problem
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Justin
4WebHelp Addict
4WebHelp Addict


Joined: 07 Jan 2002
Posts: 1060

PostPosted: Tue Jun 10, 2003 2:20 pm (20 years, 10 months ago) Reply with QuoteBack to Top

Check out :
http://unitedhosting.co.uk/forums/index.php?board=7;action=display;threadid=1126;start=0#lastPost

I can't seem to include showsurvey.php?surveyID=2 from my index page, it just doesn't work, I've tried full, absoloute, and paths, and neither work, a URL works, but thats been taken out in PHP 4.3.2, and my server is being upgraded in a few days to that, so it won't work at all then!

HELP!
OfflineView User's ProfileFind all posts by JustinSend Personal MessageSend email
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Tue Jun 10, 2003 2:53 pm (20 years, 10 months ago) Reply with QuoteBack to Top

You can't include a file with ?querystring=whatever in it. Wink

You have to set the variable in PHP.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Justin
4WebHelp Addict
4WebHelp Addict


Joined: 07 Jan 2002
Posts: 1060

PostPosted: Tue Jun 10, 2003 2:55 pm (20 years, 10 months ago) Reply with QuoteBack to Top

But you can with a full URL which PHP.net removed from PHP 4.3.2, it's so stupid.
OfflineView User's ProfileFind all posts by JustinSend Personal MessageSend email
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Tue Jun 10, 2003 3:00 pm (20 years, 10 months ago) Reply with QuoteBack to Top

It's not stupid. PHP is opening a file, bypassing "the Internet", and thus bypassing Apache at the same time, so it cannot pass a query string.

Include()ing a URL is wasteful, since the file is sitting right there on the website Smile. [I was doing that on a few forum related files at 4WebHelp until I realised how silly it was Very Happy (and got fed up of this server being the first host in our stats Laughing] As to removing the possibility of including a URL, that may be stupid - I haven't looked into it Smile.

http://www.php.net/include/ wrote:
// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Tue Jun 10, 2003 7:26 pm (20 years, 10 months ago) Reply with QuoteBack to Top

No it's not disabled in 4.3.2 , i just tested it with it.

From MAN:
============
Warning
Windows versions of PHP prior to PHP 4.3.0 do not support accessing remote files via this function, even if allow_url_fopen is enabled.


Example 12-5. include() through HTTP

Code:
<?php

/* This example assumes that www.example.com is configured to parse .php *
 * files and not .txt files. Also, 'Works' here means that the variables *
 * $foo and $bar are available within the included file.                 */

// Won't work; file.txt wasn't handled by www.example.com as PHP
include 'http://www.example.com/file.txt?foo=1&bar=2';

// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';

// Works.
include 'http://www.example.com/file.php?foo=1&bar=2';

$foo = 1;
$bar = 2;
include 'file.txt';  // Works.
include 'file.php';  // Works.

?>

===============

________________________________
Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.2105 seconds :: 19 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme