Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2009-09-04 05:22:56

analogbernd
Member
Registered: 2009-02-14
Posts: 26
Website

using extern.php on extern page

Hello,

I will build my own portal page. Not a big thing. Only some summary information. I tried to include as follows:

include ("http://example.com/extern.php?action=online&type=html");

This should show me online users on my page. But it doesnt work. If I go directly to this lin it works.

Whats wrong?

Thanks

Offline

#2 2009-09-04 06:55:04

FSX
Developer
From: NL
Registered: 2008-05-09
Posts: 805
Website

Re: using extern.php on extern page

allow_url_include is probably disabled in PHP.

I suggest you look at the code in extern.php and use/copy that. Which is also better than including extern.php.

Offline

#3 2009-09-04 13:08:56

artoodetoo
Member
From: Far-Far-Away
Registered: 2008-05-11
Posts: 207

Re: using extern.php on extern page

very likely you cannot include data via http
see allow-url-fopen for help

and, of course, try to enable error displaying to catch error

Offline

#4 2009-09-05 04:20:50

analogbernd
Member
Registered: 2009-02-14
Posts: 26
Website

Re: using extern.php on extern page

Hello,


allow_url_fopen    On    On

I tried to use these official samples from this wiki here
http://fluxbb.org/wiki/v1.2:syndication

On my server allow_url_fopen is on. In same file I define the path to root and use require.

require PUN_ROOT.'include/common.php';

it works. But why I cant use the official examples?

Thanks

Offline

#5 2009-09-05 13:40:05

Smartys
Former Developer
Registered: 2008-04-27
Posts: 3,135
Website

Re: using extern.php on extern page

analogbernd wrote:

Hello,


allow_url_fopen    On    On

OK: is display_errors on? That would help us diagnose the issue. My guess is your host has some DNS issue that's making it hard for the server to access itself like that.

analogbernd wrote:

In same file I define the path to root and use require.

require PUN_ROOT.'include/common.php';

it works. But why I cant use the official examples?

Because normal includes don't use URLs, they use relative paths within the same filesystem.

Offline

#6 2009-09-05 15:53:27

hcgtv
Member
From: Charlotte, NC
Registered: 2008-05-07
Posts: 419
Website

Re: using extern.php on extern page

Nowadays, for security reasons, web servers are locking down. I don't recall when including extern.php started to give me errors, but tech support suggested using curl.

This is what I do at PHPXref to grab the latest updates from a PunBB forum:

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://phpxref.net/extern.php?action=new&show=10&fid=5');
curl_exec($curl_handle);
curl_close($curl_handle);

Bert Garcia - When all you have is a keyboard

Offline

#7 2009-09-06 16:58:04

analogbernd
Member
Registered: 2009-02-14
Posts: 26
Website

Re: using extern.php on extern page

I found the problem. I tried to use this code

define('PUN_ROOT', '../path/otherpath/');
require PUN_ROOT.'include/common.php';
echo"Hello ".pun_htmlspecialchars($pun_user['username']); 

to say hello to users. In the moment if I include this, the page will not include the RSS. If I deactivate the "hello" block I can include the RSS from extern.php

Is this a bug or whats happen?

Thanks

Last edited by analogbernd (2009-09-06 16:58:31)

Offline

#8 2009-09-06 17:13:13

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 4,071
Website

Re: using extern.php on extern page

Well, in this case, functions.php would be included twice. What was the problem? Did it just display nothing or was there an error message?

"But it doesn't work" really is somewhat of an inprecise description.


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Online

#9 2009-09-06 18:10:40

analogbernd
Member
Registered: 2009-02-14
Posts: 26
Website

Re: using extern.php on extern page

I can only say: It shows nothing. No errors.

Offline

Board footer

Powered by FluxBB 1.5.0