SitePoint Sponsor |
|
User Tag List
Results 1 to 19 of 19
-
Jun 26, 2001, 13:16 #1
- Join Date
- Feb 2001
- Location
- Marietta, GA
- Posts
- 274
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Can no longer Include an external link
Last week my host upgraded me from PHP version 3.0.19 to version 4.0.4pl1, at my request. Everything has been running great, except for one thing - I can no longer "include" external links.
Specifically, I have a page that shows upcoming concert listings, thanks to itickets.com. However, now it gives me an error. To see it in action, go to http://www.christianguitar.ws/concerts/, and type in "Ginny Owens". It should show all of her concerts - instead, it shows an error.
Warning: Failed opening 'http://www.itickets.com/partners/insertphp?brand=120&selectName=1&sw=ginny owens&lim=' for inclusion (include_path='') in /home/web/c/christianguitar.ws/htdocs/concerts/index.php on line 114
I'm thinking that it's some sort of misconfiguration in my php.ini, but my host (of course) says that it's not. Also, the URL that it "failed" to open is always valid.
Lastly, you can check out my PHP configuration at the following address:
http://www.christianguitar.ws/boards/phpinfo.php
Any help would be much appreciated. Thanks!
Mickey
-
Jun 26, 2001, 13:20 #2
If this has only happened since the upgrade it must be a problem with the host
Sean
-
Jun 26, 2001, 13:21 #3
- Join Date
- Jul 1999
- Location
- Derbyshire, UK
- Posts
- 4,411
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try using readfile() instead of include, include was never really meant to be used for including pages from other servers.
Karl Austin :: Profile :: KDA Web Services Ltd.
Business Web Hosting :: Managed Dedicated Hosting
Call 0800 542 9764 today and ask how we can help your business grow.
-
Jun 26, 2001, 13:25 #4
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The configuration looks good to me, can tell us the code you're using?
-
Jun 26, 2001, 13:26 #5
- Join Date
- Feb 2001
- Location
- Marietta, GA
- Posts
- 274
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Sean - I agree it is probably with the host. However, I need something specific to say. ("it's a problem with....")
Karl - I tried that, and now I'm getting the following error:
Warning: readfile("http://www.itickets.com/partners/insertphp?brand=120&selectName=1&sw=ginny owens&lim=") - Success in /home/web/c/christianguitar.ws/htdocs/concerts/index.php on line 114
Mickey
-
Jun 26, 2001, 13:29 #6
- Join Date
- Feb 2001
- Location
- Marietta, GA
- Posts
- 274
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That line of code is simply:
Code:<? if($brand>0) { include "http://www.itickets.com/partners/insertphp?brand=$brand&selectName=$selectName&sw=$sw&lim=$lim"; } ?>
Mickey
-
Jun 26, 2001, 13:30 #7
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You need to urlencode() the url first.
-
Jun 26, 2001, 13:32 #8
- Join Date
- Feb 2001
- Location
- Marietta, GA
- Posts
- 274
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok, but this worked fine with PHP version 3. Did something like that change between 3 and 4?
Mickey
-
Jun 26, 2001, 13:34 #9
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Beats me, you should have been doing it in PHP3 too.
-
Jun 26, 2001, 13:40 #10
- Join Date
- Feb 2001
- Location
- Marietta, GA
- Posts
- 274
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok, now I get a messier error.
Code:Warning: Failed opening 'http%3A%2F%2Fwww.itickets.com%2Fpartners%2Finsertphp%3Fbrand%3D%24brand%26selectName%3D%24selectName%26sw%3D%24sw%26lim%3D%24lim' for inclusion (include_path='') in /home/web/c/christianguitar.ws/htdocs/concerts/index.php on line 117
Mickey
-
Jun 26, 2001, 13:41 #11
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Don't use urlencode() on that url.
Could be a bug in your version of PHP, have you searched the bug reports yet? Also unless your variables have weird characters in them then you don't need urlencode(). IN the bug reports on php.net it does mention something about include() and readfile() although the specific problem is not listed. I would coax them into putting a newer version on your server and see if that helps.Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jun 26, 2001, 13:42 #12
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ah sorry, you just need to urlencode $sw (because of the space).
-
Jun 26, 2001, 13:44 #13
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ah.. right my bad as anarchos said if there will be spaces or weird cahracters in a variable you'll need to encode() it, but just the variable not the whole url.
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jun 26, 2001, 14:34 #14
- Join Date
- Jun 2000
- Location
- Sydney, Australia
- Posts
- 3,798
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Just a follow up to Karl's post. I just checked the manual and it says that using a remote file through HTTP in an include directive is OK and even gives examples.
This is a weird one eh? But it sounds like the whitespace might be a problem. In this case the trick is to urlencode() the varialbes before placing them in the URL string: eg:
$brand = urlencode($brand);
etc...
-
Jun 26, 2001, 14:36 #15
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yes I said that three posts ago....
-
Jun 26, 2001, 16:31 #16
- Join Date
- Jun 2000
- Location
- Sydney, Australia
- Posts
- 3,798
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
...err, sorry Anarchos. I did not mean to speak over you. I did not read the thread well enough. I got distracted looking in the manual.
-
Jun 26, 2001, 18:22 #17
- Join Date
- Feb 2001
- Location
- Marietta, GA
- Posts
- 274
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for all of the suggestions. Doing the urlencode() on the individual variables made sense, and made it look cleaner. However, the error was still the same. I did some research on PHP bugs, and found a few that were related to version 4.0.5, and I'm still on 4.0.4pl1, which shouldn't be affected.
I'm still thinking that it's a PHP setup/config error, but I don't know what it could be. I've read a bit about the "URL fopen wrappers" needing to be enabled, but I haven't been able to find anything about that in my php.ini file, or in my phpinfo. Any ideas about that?
Thanks!
Mickey
-
Jun 26, 2001, 20:50 #18
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yeah I checked that, it's the allow_url_fopen in your php.ini and it's already set correctly. Can you post the updated code?
-
Jun 27, 2001, 08:25 #19
- Join Date
- Feb 2001
- Location
- Marietta, GA
- Posts
- 274
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's been fixed! The problem (I guess) is that PHP4 is too smart. PHP3 just linked to that address, no problem. However, the address didn't point to a file - just a directory (and then it pulled up the index.php3 file). I guess PHP4 needs a specific file to point to, or it's a bug or something. When I changed it from:
include("http://...../insertphp?brand=...
to:
include("http://.../insertphp/index.php3?brand=...
it fixed it!
Thanks to everyone for all of your help with this.
Mickey
Bookmarks