Feeds

back to article Harness XML with PHP 5 extensions

PHP is one of the most commonly used languages for developing web sites while XML has become an industry standard for exchanging data. Increasingly, web sites use XML to transfer data through web feeds such as RSS and Atom, or through web services. PHP 5 XML extensions provide support for parsing, transformation, XPath …

COMMENTS

This topic is closed for new posts.
Linux

Why are you running PHP and Apache

under Windows, they work fine where they belong under Linux it's like playing guitar with gloves on there is no point.

0
0
Silver badge
Linux

Cosmic Symphonies.....

"Why are you running PHP and Apache .... under Windows, they work fine where they belong under Linux it's like playing guitar with gloves on there is no point." ... By Alan Donaly

Posted Friday 15th August 2008 15:52 GMT

It is in Deed, indeed, an Enigmatic Distraction, Alan. You play a mean Chord, yourself.

0
0

Timely...

I needed to do something like this today and this article came along exactly at the right time.

0
0
Boffin

Over thinking the pipe works

Ach, what's wrong with JSON and parsing INI files..

0
0
E

Real men

...use binary wireline protocols.

0
0
Thumb Up

Real men

Punched tape FTW!

0
0
Flame

Aesthetics

All well and good, but the code examples are hardly beautiful or consistent, with indentation, spacing, whether strings go in single or double quotes and whether to place a for loop's opening { on the end of the line with the 'for' or on its own on the following one being generally undecided.

for($i=0; $I<$titleNodeList->length;$i++)

is a corker in one line. A space after each element of the for statement or not? Does PHP have case-insensitive variable names? Don't know, but I'd have to check..

0
0
b

string manipulation, baby!

who needs all this, if you can manipulate strings?

ok, fair enough, your data HAS to be consistent, but...

..who remembers f$locate(substring, string) using DCL on VMS???

"oh, boo, hoo, i can't do it without a function!"

;)

p.s. sorry, useful article, saved ;)

stuff and nonsense: http://www.eupeople.net/forum

0
0
Unhappy

@Alan Donaly

The reason they're suggesting Windows is because you'll find it a challenge to find a Linux web host out there that offers PHP 5 with the XML and XSLT libraries enabled. If you're a web developer who relies on third-party hosting companies, you're screwed, because they will insist these are "non-standard" libraries (meaning they're not enabled in CPanel).

If you're already running a Linux web server yourself, you've been aware of these technologies for a couple years now, so this article is already too elementary for you.

So the audience for this article are people running their own Windows servers who are dissatisfied with Microsoft web offerings.

0
0
Thumb Down

One reason why I never got on with PHP

Arbitrary method naming, no variable declarations & no strict types.

Just using Perl for cron scripting, I've found that "using strict" saves a hell of a lot of time. Can anyone imaging using just objects and (void *) in C, and hoping to remember what the hell it should be?

Flame all you like, but I use C# for websites, yes I have to pay for it, and no I don't use it to generate dodgy [x]html, but I've always been able to read the code (even before I was even vaguely proficient in it), PHP still gives me issues.

0
0
Coat

Why not a WAMP server

Hmmm let me look here yeah run an Apache 2 with PHP 5 and I've probably got that extension somewhere and can easy switch it on, do a lot of work with Distributed Computing Stats and they all export XML, mind you were running a LAMP server which is running sweet.. I do test some stuff using XAMPP save you the hassle of making sure you know where everything is as it paths it for you enables all the stuff and for windows anyway gives you an nice enough GUI CP to swtich apache, mysql, mercury mail (don't use that bit) and an FTP client so it's a nice enough package strictly for dev though unless you wanna play around with it a lot and get it a bit more secure for running it on a real site, yeah oh sure I've looked as .asp no thanks I can figure out PHP much quicker, not looked at perl, anyone using void* to create something they don't know enough about sorry shouldn't really do that create object on the fly with correct type is totally possible, php class statement to create the whole thing with internal / extrenal visible functions and interativity.

for($i=0; $I<$titleNodeList->length;$i++)

{ echo $titleNodeList->item($i)->nodeValue."<br/>\n"; }

much more consise and readable... and should do exactly the same..

I'll get me coat and go back to converting something from table to div...

0
0
Bronze badge
Unhappy

Real men...

...flip switches on the front chassis.

I remember having to do this for one of my Uni assignments. I think the main reason behind it was to make you glad such things as compilers existed:

1) hit the "clear memory" button - memory is now wiped and memory pointer is reset to location 0.

2) flip the 8 switches on the front of chassis to represent the binary value you want stored at the location pointed to by the memory pointer.

3) hit the "store" button - that binary value is now stored in the current memory location. Memory pointer moves to next memory location.

4) Repeat steps 2 & 3 until you have entered your program. DO NOT MAKE A MISTAKE!

5) Hit the "run" button.

Oh... and if you DO make a mistake - go back to step 1... you can't edit your program, only start from scratch.

<shudder> Oh, we were so glad to be allowed to use cross-platform compilers for the next assignment.

0
0
Stop

Sorry, it should be LAMP, but I see why your WAMP'ing it.

"find it a challenge to find a Linux web host out there that offers PHP 5 with the XML and XSLT"

Google found some pretty quick. Whilst I agree that your saying you looking to show the Microsoft unhappy people what they can do with PHP and XML, think writing all about PHP+XML would be enough, I don't really want/need to know how to install it. Plus if your going down the unhappy MS route, why not write about how to make PHP work on IIS?

Plus I agree, you'd want to host it under Linux anyway.

0
0
Black Helicopters

Mhhh..why use extension for XML in PHP5

Well.. I guess the easier and bettor solution is to use "simpleXml" in PHP5. No need to enable or add it. The SimpleXML extension is enabled by default in PHP5.

Sample Usage:

if (file_exists('test.xml')) {

$xml = simplexml_load_file('test.xml');

echo "<pre>";

print_r($xml);

}

else {

exit('Failed to open test.xml.');

}

When printed, each node of the XMl can be access like this:

echo $xml->NodeName;

Best Regards,

Rochak Chauhan.

0
0
E

@John Bayly

"Arbitrary method naming, no variable declarations & no strict types."

Not sure what you mean by arbitrary method naming - not a C# user.

PHP 5 did add support for typed parameters to class methods. It's not required but it's there and I've found it useful.

I guess it took me quite some time after learning C & C++ to accept fairly typeless scripting languages, but I can't recall where PHP confused types and did the wrong thing.

Is C# as strongly typed as, say, C++ without casting and void* ?

0
0
This topic is closed for new posts.