715 posts
  • Author Level 2
  • Collector Level 2
  • Exclusive Author
  • Belgium
+1 more
Hy-Studio
says

Hello,

I’m looking for a way to parse html code for validation by using php. The html code will be like this:

<object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F12483908" /> <param name="allowscriptaccess" value="always" /> <embed src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F12483908" allowscriptaccess="always" type="application/x-shockwave-flash" height="81" width="100%"> </embed></object>

Anyone had some experience with this?

Thanks!

1173 posts
  • 6 Years of Membership
  • Australia
  • Author Level 5
  • Beta Tester
+4 more
Motionreactor
says

Parse for what exactly?

Are you checking specific attributes? or the whole object/embed?

715 posts
  • Author Level 2
  • Collector Level 2
  • Exclusive Author
  • Belgium
+1 more
Hy-Studio
says

I would like to parse the whole object.

1149 posts
  • Affiliate Level 1
  • Author Level 3
  • Beta Tester
  • Collector Level 2
+3 more
fillerspace
says

Looks like xhtml…maybe you can try simplexml?

715 posts
  • Author Level 2
  • Collector Level 2
  • Exclusive Author
  • Belgium
+1 more
Hy-Studio
says

I don’t think that simplexml would work, this is normally for XML , never saw it with xhtml.

99 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 1
  • Top Monthly Author
+5 more
Lamovo
says

Anyone had some experience with this?

Yes.


I would like to parse the whole object.

There’s no point in parsing the whole object. Which information from the object do you want to extract for validation?

Where’s the input coming from?
Where’s it going to?


I don’t think that simplexml would work, this is normally for XML , never saw it with xhtml.

PHP DOMDocument will work with HTML .

1173 posts
  • 6 Years of Membership
  • Australia
  • Author Level 5
  • Beta Tester
+4 more
Motionreactor
says

You’ll need to explain both the context of your problem and the use case, otherwise we are unable to offer any useful advice.

by
by
by
by
by
by