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

Home » Imported messages » comp.lang.php » $dom->loadHTMLFile() error
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: $dom->loadHTMLFile() error [message #183673 is a reply to message #183671] Fri, 08 November 2013 07:35 Go to previous messageGo to previous message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma:
Senior Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: values won't transfer
Next Topic: array how is done
Goto Forum:
  

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

Current Time: Fri Jan 31 14:51:27 GMT 2025

Total time taken to generate the page: 0.04235 seconds