Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #11760 > unrolled thread

$dom->loadHTMLFile() error

Started bygdunn <gdunn@example.com>
First post2013-11-07 20:47 +0000
Last post2013-11-08 19:28 +0000
Articles 6 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  $dom->loadHTMLFile() error gdunn <gdunn@example.com> - 2013-11-07 20:47 +0000
    Re: $dom->loadHTMLFile() error Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-07 17:46 -0500
      Re: $dom->loadHTMLFile() error Arno Welzel <usenet@arnowelzel.de> - 2013-11-08 08:35 +0100
        Re: $dom->loadHTMLFile() error Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-08 07:57 -0500
    Re: $dom->loadHTMLFile() error Arno Welzel <usenet@arnowelzel.de> - 2013-11-08 08:35 +0100
      Re: $dom->loadHTMLFile() error gdunn <gdunn@example.com> - 2013-11-08 19:28 +0000

#11760 — $dom->loadHTMLFile() error

Fromgdunn <gdunn@example.com>
Date2013-11-07 20:47 +0000
Subject$dom->loadHTMLFile() error
Message-ID<6ab6d$527bfc4f$9440befe$19339@STARBAND.NET>
I wrote a small block of code for a mate that parses another web page and 
it displays selected results from a table there. It runs fine locally using 
php 5.3. I'm not sure what version of php is in use on his web server, but
it appears that "<?php ... $dom->" is being parsed as a single tag in the 
following code:

----------BEGIN code----------------------
<?php

// Get the node_id from what was passed to this page.
if (isset($_GET['node_id'])) {
  $node_id = $_GET['node_id'];
} else {
  echo "No IRLP node number stated\n";
  break 3;
}

// Get the node status HTML code.
$url = "http://status.irlp.net/?nodeid=$node_id" ;
$dom = new DOMDocument;
$dom->loadHTMLFile("$url");
$links = $dom->getElementsByTagName('td');
foreach($links as $i){
  $node_status[] = $i->textContent;
}

// Print the fields of interest. Comment undesired lines such as:
//echo "<b>$node_status[40]</b> $node_status[41]<br>";
echo "<b>$node_status[40]</b> $node_status[41]<br>";
echo "<b>$node_status[42]</b> $node_status[43]<br>";
echo "<b>$node_status[44]</b> $node_status[45]";

?>
----------END code----------------------

On my php5.3, it returns (e.g. sans bold):

Local node date/time 14:39:10 on Nov 07 2013 CST
Current Node Status: IDLE for 0 days, 1 hours, 43 minutes, 7 seconds.
Last heard from Node: 12:56:02 on Nov 07 2013 CST

On his http://stn3717.ip.irlp.net:15426/get_node_status.php?node_id=3717

loadHTMLFile("$url"); $links = $dom->getElementsByTagName('td'); 
foreach($links as $i){ $node_status[] = $i->textContent; } 
// Print the fields of interest. Comment undesired lines such as: 
//echo "$node_status[40] $node_status[41]"; 
echo "$node_status[40] $node_status[41]"; 
echo "$node_status[42] $node_status[43]"; 
echo "$node_status[44] $node_status[45]"; ?> 

Is it possible that php isn't operational on that site, or that it
needs to be enabled on a per-user basis?

[toc] | [next] | [standalone]


#11763

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-11-07 17:46 -0500
Message-ID<l5h58n$t3p$1@dont-email.me>
In reply to#11760
On 11/7/2013 3:47 PM, gdunn wrote:
> I wrote a small block of code for a mate that parses another web page and
> it displays selected results from a table there. It runs fine locally using
> php 5.3. I'm not sure what version of php is in use on his web server, but
> it appears that "<?php ... $dom->" is being parsed as a single tag in the
> following code:
>
> ----------BEGIN code----------------------
> <?php
>
> // Get the node_id from what was passed to this page.
> if (isset($_GET['node_id'])) {
>    $node_id = $_GET['node_id'];
> } else {
>    echo "No IRLP node number stated\n";
>    break 3;
> }
>
> // Get the node status HTML code.
> $url = "http://status.irlp.net/?nodeid=$node_id" ;
> $dom = new DOMDocument;
> $dom->loadHTMLFile("$url");
> $links = $dom->getElementsByTagName('td');
> foreach($links as $i){
>    $node_status[] = $i->textContent;
> }
>
> // Print the fields of interest. Comment undesired lines such as:
> //echo "<b>$node_status[40]</b> $node_status[41]<br>";
> echo "<b>$node_status[40]</b> $node_status[41]<br>";
> echo "<b>$node_status[42]</b> $node_status[43]<br>";
> echo "<b>$node_status[44]</b> $node_status[45]";
>
> ?>
> ----------END code----------------------
>
> On my php5.3, it returns (e.g. sans bold):
>
> Local node date/time 14:39:10 on Nov 07 2013 CST
> Current Node Status: IDLE for 0 days, 1 hours, 43 minutes, 7 seconds.
> Last heard from Node: 12:56:02 on Nov 07 2013 CST
>
> On his http://stn3717.ip.irlp.net:15426/get_node_status.php?node_id=3717
>
> loadHTMLFile("$url"); $links = $dom->getElementsByTagName('td');
> foreach($links as $i){ $node_status[] = $i->textContent; }
> // Print the fields of interest. Comment undesired lines such as:
> //echo "$node_status[40] $node_status[41]";
> echo "$node_status[40] $node_status[41]";
> echo "$node_status[42] $node_status[43]";
> echo "$node_status[44] $node_status[45]"; ?>
>
> Is it possible that php isn't operational on that site, or that it
> needs to be enabled on a per-user basis?
>

Sure it's possible PHP isn't installed.  Did you ask whomever is in 
charge of the server?

What do you see when you display the page source in the browser?  Do you 
see the <?php tag, for instance?

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#11766

FromArno Welzel <usenet@arnowelzel.de>
Date2013-11-08 08:35 +0100
Message-ID<527C945B.9030207@arnowelzel.de>
In reply to#11763
Jerry Stuckle, 2013-11-07 23:46:

> On 11/7/2013 3:47 PM, gdunn wrote:
>> I wrote a small block of code for a mate that parses another web page and
>> it displays selected results from a table there. It runs fine locally using
>> php 5.3. I'm not sure what version of php is in use on his web server, but
>> it appears that "<?php ... $dom->" is being parsed as a single tag in the
>> following code:
>>
>> ----------BEGIN code----------------------
>> <?php
>>
>> // Get the node_id from what was passed to this page.
>> if (isset($_GET['node_id'])) {
>>    $node_id = $_GET['node_id'];
>> } else {
>>    echo "No IRLP node number stated\n";
>>    break 3;
>> }
>>
>> // Get the node status HTML code.
>> $url = "http://status.irlp.net/?nodeid=$node_id" ;
>> $dom = new DOMDocument;
>> $dom->loadHTMLFile("$url");
>> $links = $dom->getElementsByTagName('td');
>> foreach($links as $i){
>>    $node_status[] = $i->textContent;
>> }
>>
>> // Print the fields of interest. Comment undesired lines such as:
>> //echo "<b>$node_status[40]</b> $node_status[41]<br>";
>> echo "<b>$node_status[40]</b> $node_status[41]<br>";
>> echo "<b>$node_status[42]</b> $node_status[43]<br>";
>> echo "<b>$node_status[44]</b> $node_status[45]";
>>
>> ?>
>> ----------END code----------------------
>>
>> On my php5.3, it returns (e.g. sans bold):
>>
>> Local node date/time 14:39:10 on Nov 07 2013 CST
>> Current Node Status: IDLE for 0 days, 1 hours, 43 minutes, 7 seconds.
>> Last heard from Node: 12:56:02 on Nov 07 2013 CST
>>
>> On his http://stn3717.ip.irlp.net:15426/get_node_status.php?node_id=3717
>>
>> loadHTMLFile("$url"); $links = $dom->getElementsByTagName('td');
>> foreach($links as $i){ $node_status[] = $i->textContent; }
>> // Print the fields of interest. Comment undesired lines such as:
>> //echo "$node_status[40] $node_status[41]";
>> echo "$node_status[40] $node_status[41]";
>> echo "$node_status[42] $node_status[43]";
>> echo "$node_status[44] $node_status[45]"; ?>
>>
>> Is it possible that php isn't operational on that site, or that it
>> needs to be enabled on a per-user basis?
>>
> 
> Sure it's possible PHP isn't installed.  Did you ask whomever is in 
> charge of the server?
> 
> What do you see when you display the page source in the browser?  Do you 
> see the <?php tag, for instance?

Just open
<http://stn3717.ip.irlp.net:15426/get_node_status.php?node_id=3717> in a
browser - then you will see it as well ;-)


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [next] | [standalone]


#11767

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-11-08 07:57 -0500
Message-ID<l5in3n$834$2@dont-email.me>
In reply to#11766
On 11/8/2013 2:35 AM, Arno Welzel wrote:
> Jerry Stuckle, 2013-11-07 23:46:
>
>> On 11/7/2013 3:47 PM, gdunn wrote:
>>> I wrote a small block of code for a mate that parses another web page and
>>> it displays selected results from a table there. It runs fine locally using
>>> php 5.3. I'm not sure what version of php is in use on his web server, but
>>> it appears that "<?php ... $dom->" is being parsed as a single tag in the
>>> following code:
>>>
>>> ----------BEGIN code----------------------
>>> <?php
>>>
>>> // Get the node_id from what was passed to this page.
>>> if (isset($_GET['node_id'])) {
>>>     $node_id = $_GET['node_id'];
>>> } else {
>>>     echo "No IRLP node number stated\n";
>>>     break 3;
>>> }
>>>
>>> // Get the node status HTML code.
>>> $url = "http://status.irlp.net/?nodeid=$node_id" ;
>>> $dom = new DOMDocument;
>>> $dom->loadHTMLFile("$url");
>>> $links = $dom->getElementsByTagName('td');
>>> foreach($links as $i){
>>>     $node_status[] = $i->textContent;
>>> }
>>>
>>> // Print the fields of interest. Comment undesired lines such as:
>>> //echo "<b>$node_status[40]</b> $node_status[41]<br>";
>>> echo "<b>$node_status[40]</b> $node_status[41]<br>";
>>> echo "<b>$node_status[42]</b> $node_status[43]<br>";
>>> echo "<b>$node_status[44]</b> $node_status[45]";
>>>
>>> ?>
>>> ----------END code----------------------
>>>
>>> On my php5.3, it returns (e.g. sans bold):
>>>
>>> Local node date/time 14:39:10 on Nov 07 2013 CST
>>> Current Node Status: IDLE for 0 days, 1 hours, 43 minutes, 7 seconds.
>>> Last heard from Node: 12:56:02 on Nov 07 2013 CST
>>>
>>> On his http://stn3717.ip.irlp.net:15426/get_node_status.php?node_id=3717
>>>
>>> loadHTMLFile("$url"); $links = $dom->getElementsByTagName('td');
>>> foreach($links as $i){ $node_status[] = $i->textContent; }
>>> // Print the fields of interest. Comment undesired lines such as:
>>> //echo "$node_status[40] $node_status[41]";
>>> echo "$node_status[40] $node_status[41]";
>>> echo "$node_status[42] $node_status[43]";
>>> echo "$node_status[44] $node_status[45]"; ?>
>>>
>>> Is it possible that php isn't operational on that site, or that it
>>> needs to be enabled on a per-user basis?
>>>
>>
>> Sure it's possible PHP isn't installed.  Did you ask whomever is in
>> charge of the server?
>>
>> What do you see when you display the page source in the browser?  Do you
>> see the <?php tag, for instance?
>
> Just open
> <http://stn3717.ip.irlp.net:15426/get_node_status.php?node_id=3717> in a
> browser - then you will see it as well ;-)
>
>

I know I can open it.  But telling him that it isn't installed doesn't 
help him learn anything.

I prefer to teach a person to fish; you just give him the fish.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#11765

FromArno Welzel <usenet@arnowelzel.de>
Date2013-11-08 08:35 +0100
Message-ID<527C9433.6090007@arnowelzel.de>
In reply to#11760
gdunn, 2013-11-07 21:47:

[...]
> On his http://stn3717.ip.irlp.net:15426/get_node_status.php?node_id=3717
> 
> loadHTMLFile("$url"); $links = $dom->getElementsByTagName('td'); 
> foreach($links as $i){ $node_status[] = $i->textContent; } 
> // Print the fields of interest. Comment undesired lines such as: 
> //echo "$node_status[40] $node_status[41]"; 
> echo "$node_status[40] $node_status[41]"; 
> echo "$node_status[42] $node_status[43]"; 
> echo "$node_status[44] $node_status[45]"; ?> 
> 
> Is it possible that php isn't operational on that site, or that it
> needs to be enabled on a per-user basis?

It's obvious that PHP is not being executed. Ask the site administrator
if this can be changed.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [next] | [standalone]


#11768

Fromgdunn <gdunn@example.com>
Date2013-11-08 19:28 +0000
Message-ID<3015f$527d3b4d$9440befe$11521@STARBAND.NET>
In reply to#11765
On Fri, 08 Nov 2013 08:35:15 +0100, Arno Welzel wrote:

> It's obvious that PHP is not being executed. Ask the site administrator
> if this can be changed.

Thanks Arno, the site administrator reported some missing dependencies; 
all is working properly now.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web