FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Include gives warning
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Include gives warning [message #184301] Sat, 21 December 2013 15:36 Go to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
I am attempting to make this work on the home page but the warnings keep
coming.
Anything that is echoed returns nothing or zero.
Because $year is NOT being acquired properly.
So how do I make it work right?

Now let us not dick around with bashing me over my past and current faults.
Or PROBABLE errors such as the use of the iframe.
Bash me, don't expect a reply.



<?php
$year=$_GET['b'];
echo $year;
?>
<div id="wrapper">

<div id="acol" style="float:left; width:3in; height:8in; overflow:auto;
border:solid 2px #f00;">

<?php
include "http://mroldies.net/artists/".$year."artists.php";

echo $art60[1][0];
echo "<br>";
$rows=count($art60);
echo $rows;
?>

</div>

http://mroldies.net/artists/
Re: Include gives warning [message #184302 is a reply to message #184301] Sat, 21 December 2013 16:03 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Sat, 21 Dec 2013 10:36:29 -0500, richard wrote:

> I am attempting to make this work on the home page but the warnings keep
> coming.
> Anything that is echoed returns nothing or zero.
> Because $year is NOT being acquired properly.
> So how do I make it work right?
>
> Now let us not dick around with bashing me over my past and current faults.
> Or PROBABLE errors such as the use of the iframe.
> Bash me, don't expect a reply.
>
>
>
> <?php
> $year=$_GET['b'];
> echo $year;
> ?>
> <div id="wrapper">
>
> <div id="acol" style="float:left; width:3in; height:8in; overflow:auto;
> border:solid 2px #f00;">
>
> <?php
> include "http://mroldies.net/artists/".$year."artists.php";
>
> echo $art60[1][0];
> echo "<br>";
> $rows=count($art60);
> echo $rows;
> ?>
>
> </div>
>
> http://mroldies.net/artists/

Solved the warning issue.
I had to include the value in the url.
so that the include statement now reads
include "http://mroldies.net/artists/index.php?b=".$year;

The echoed items still nothing or zero.
Re: Include gives warning [message #184303 is a reply to message #184301] Sat, 21 December 2013 18:26 Go to previous messageGo to next message
Derek Turner is currently offline  Derek Turner
Messages: 48
Registered: October 2010
Karma: 0
Member
On Sat, 21 Dec 2013 10:36:29 -0500, richard wrote:

> I am attempting to make this work on the home page but the warnings keep
> coming.
> Anything that is echoed returns nothing or zero.
> Because $year is NOT being acquired properly.
> So how do I make it work right?
>
> Now let us not dick around with bashing me over my past and current
> faults.
> Or PROBABLE errors such as the use of the iframe.
> Bash me, don't expect a reply.
>
>
>
> <?php $year=$_GET['b'];
> echo $year;
> ?>
> <div id="wrapper">
>
> <div id="acol" style="float:left; width:3in; height:8in; overflow:auto;
> border:solid 2px #f00;">
>
> <?php include "http://mroldies.net/artists/".$year."artists.php";
>
> echo $art60[1][0];
> echo "<br>";
> $rows=count($art60);
> echo $rows;
> ?>
>
> </div>
>
> http://mroldies.net/artists/

RTFM on the correct way to use include. HINT it has to be the true path to
a file on your server.
Re: Include gives warning [message #184304 is a reply to message #184303] Sat, 21 December 2013 19:02 Go to previous messageGo to next message
Lew Pitcher is currently offline  Lew Pitcher
Messages: 60
Registered: April 2013
Karma: 0
Member
On Saturday 21 December 2013 13:26, in comp.lang.php, "Derek Turner"
<frderek(at)cesmail(dot)net> wrote:

> On Sat, 21 Dec 2013 10:36:29 -0500, richard wrote:
>
>> I am attempting to make this work on the home page but the warnings keep
>> coming.
>> Anything that is echoed returns nothing or zero.
>> Because $year is NOT being acquired properly.
>> So how do I make it work right?
>>
>> Now let us not dick around with bashing me over my past and current
>> faults.
>> Or PROBABLE errors such as the use of the iframe.
>> Bash me, don't expect a reply.
>>
>>
>>
>> <?php $year=$_GET['b'];
>> echo $year;
>> ?>
>> <div id="wrapper">
>>
>> <div id="acol" style="float:left; width:3in; height:8in; overflow:auto;
>> border:solid 2px #f00;">
>>
>> <?php include "http://mroldies.net/artists/".$year."artists.php";
>>
>> echo $art60[1][0];
>> echo "<br>";
>> $rows=count($art60);
>> echo $rows;
>> ?>
>>
>> </div>
>>
>> http://mroldies.net/artists/
>
> RTFM on the correct way to use include. HINT it has to be the true path to
> a file on your server.

Actually, no

http://www.php.net/manual/en/function.include.php

"If "URL include wrappers" are enabled in PHP, you can specify the file to
be included using a URL (via HTTP or other supported wrapper - see
Supported Protocols and Wrappers for a list of protocols) instead of a
local pathname."

While I don't think that richard has a good grasp on programming, web
services, databases, MySQL, Apache, or PHP, it appears that he has paid
more attention to the FM than you have.


--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
Re: Include gives warning [message #184305 is a reply to message #184303] Sat, 21 December 2013 19:24 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Derek Turner wrote:

> On Sat, 21 Dec 2013 10:36:29 -0500, richard wrote:
>> <?php include "http://mroldies.net/artists/".$year."artists.php";
>>
>> […]
>
> RTFM on the correct way to use include. HINT it has to be the true path to
> a file on your server.

No, it does not; it does not even have to be a regular file. However, if
the above is to work, several conditions have to apply:

- allow_url_fopen = 1 (default),
allow_url_include = 1 (the default is 0);

- Either PHP must not parse the resource accessed like that or it must
generate from the parsed resource a PHP script resource;

- The Web server (hardware) must be able to resolve the domain name to an IP
address, using its DNS client (software).

And it still would be comparably inefficient because of the unnecessary
roundtrip.

,-<http://php.net/include>
|
| If "URL include wrappers" [1] are enabled in PHP, you can specify the file
| to be included using a URL (via HTTP or other supported wrapper - see
| Supported Protocols and Wrappers [2] for a list of protocols) instead of a
| local pathname. If the target server interprets the target file as PHP
| code, variables may be passed to the included file using a URL request
| string as used with HTTP GET. This is not strictly speaking the same thing
| as including the file and having it inherit the parent file's variable
| scope; the script is actually being run on the remote server and the
| result is then being included into the local script.
|
| [1] < http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-inc lude>
| [2] <http://www.php.net/manual/en/wrappers.php>
|
`----


PointedEars
--
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
-- Richard Cornford, comp.lang.javascript, 2011-11-14
Re: Include gives warning [message #184306 is a reply to message #184303] Sat, 21 December 2013 19:36 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On 21 Dec 2013 18:26:30 GMT, Derek Turner wrote:

> On Sat, 21 Dec 2013 10:36:29 -0500, richard wrote:
>
>> I am attempting to make this work on the home page but the warnings keep
>> coming.
>> Anything that is echoed returns nothing or zero.
>> Because $year is NOT being acquired properly.
>> So how do I make it work right?
>>
>> Now let us not dick around with bashing me over my past and current
>> faults.
>> Or PROBABLE errors such as the use of the iframe.
>> Bash me, don't expect a reply.
>>
>>
>>
>> <?php $year=$_GET['b'];
>> echo $year;
>> ?>
>> <div id="wrapper">
>>
>> <div id="acol" style="float:left; width:3in; height:8in; overflow:auto;
>> border:solid 2px #f00;">
>>
>> <?php include "http://mroldies.net/artists/".$year."artists.php";
>>
>> echo $art60[1][0];
>> echo "<br>";
>> $rows=count($art60);
>> echo $rows;
>> ?>
>>
>> </div>
>>
>> http://mroldies.net/artists/
>
> RTFM on the correct way to use include. HINT it has to be the true path to
> a file on your server.

I have experimented with this.
On MY server, as long as the include page is in the same directory, then
include "filename.php" works.
While an absolute path MUST be used if the called file is not in the same
directory.

Nice to see you got bashed for being so intelligent.
Re: Include gives warning [message #184307 is a reply to message #184306] Sat, 21 December 2013 22:09 Go to previous messageGo to next message
Beauregard T. Shagnas is currently offline  Beauregard T. Shagnas
Messages: 154
Registered: September 2010
Karma: 0
Senior Member
richard the sto0pid wrote:

> I have experimented with this.

Not very much, apparently.

> On MY server, as long as the include page is in the same directory, then
> include "filename.php" works.

Sure.

> While an absolute path MUST be used if the called file is not in the
> same directory.

Not true at all. I use the following method all the time, utilizing my
"include" directory:

include "../include/filename.php";

> Nice to see you got bashed for being so intelligent.

Pity that you will never have as much.

--
-bts
-This space for rent, but the price is high
Re: Include gives warning [message #184308 is a reply to message #184306] Sat, 21 December 2013 23:46 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Sat, 21 Dec 2013 14:36:07 -0500, richard wrote:

> ... as long as the include page is in the same directory, then
> include "filename.php" works.

You should have quit while you were ahead.

> While an absolute path MUST be used if the called file is not in the
> same directory.

Because this bit is your normal bullishit.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: Include gives warning [message #184309 is a reply to message #184306] Sun, 22 December 2013 03:42 Go to previous messageGo to next message
Evan Platt is currently offline  Evan Platt
Messages: 124
Registered: November 2010
Karma: 0
Senior Member
On Sat, 21 Dec 2013 14:36:07 -0500, richard <noreply(at)example(dot)com>
wrote:

> Nice to see you got bashed for being so intelligent.

Oh, the irony.
--
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
Re: Include gives warning [message #184310 is a reply to message #184301] Sun, 22 December 2013 15:11 Go to previous message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 21-12-2013 16:36, richard wrote:
> I am attempting to make this work on the home page but the warnings keep
> coming.
> Anything that is echoed returns nothing or zero.
> Because $year is NOT being acquired properly.
> So how do I make it work right?
>


you should have told what warning you get.

But visiting your page revealed it:
Warning: include(http://mroldies.net/artists/artists.php)
[function.include]: failed to open stream: HTTP request failed! HTTP/1.1
404 Not Found in
/home2/richbull/public_html/mroldies.net/artists/index.php on line 16

Googling for '404 Warning: include [function.include]: failed to open
stream: HTTP request failed! ' found other pages with same error here:
http://lcmstarget.tjc.edu/Student/StudentHandbook.php

But this site works:
http://www.tjc.edu/Student/StudentHandbook.php

Some working examples, and the documentation can be found here:
http://www.php.net/manual/en/function.include.php

But you will get a 404 when the page is not found.....
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: when incuding a page
Next Topic: php double form submit prevent
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 04:22:46 GMT 2024

Total time taken to generate the page: 0.02547 seconds