wakes Posted March 8, 2007 Share Posted March 8, 2007 Just wondering if anyone is interested in an article about using PHP/DOM to hook/skin (other) sites on the server level, say if they don't have an rss feed but you want to save the content, change stylesheets, add some script etc? It's pretty easy so I was thinking about doing an article for Analog.5 if anyone is interested (and my writing isn't too shit). Quote Link to comment Share on other sites More sharing options...
tanda333 Posted March 8, 2007 Share Posted March 8, 2007 not that i understand exactly what you are saying but i get enough of the gist of it to say: the token noobs wants to see more! Quote Link to comment Share on other sites More sharing options...
psychoaliendog Posted March 8, 2007 Share Posted March 8, 2007 Do you mean page scraping? XSLT? Or something with firefox and the user stylesheets? I wouldn't qualify any of those as "Hacking" or "hooking". XSLT would be, by far, the easiest way to do this, as that is what it was designed to do. It probably beats the hell out of a custom written php script that parses the html and what ever. So, to finish up, I have no f-ing clue what you were intending to say, but sure I'll be interested. :D Which will leave me filled with suspense, thrill, and hell I might even learn something. Quote Link to comment Share on other sites More sharing options...
wakes Posted March 8, 2007 Author Share Posted March 8, 2007 It will be about using the DOM server side (not necessarily php but I like it) to do stuff like: $oDoc = new DomDocument(); if (!@$oDoc->loadHTMLFile($sURL = $_REQUEST['URL'])) die("Failed to load '$sURL'"); $oQuery = new DomXPath($oDoc); if ($aNodes = $oQuery->query('//div')) { foreach ($aNodes as $oNode) { $oNode->setAttribute('style', 'border: 1px solid #FF0000'); $oNode->setAttribute('onclick', "alert('clicked'); return 0;"); } } echo $oDoc->saveHTML(); Which simply highlights all the 'div' elements on a page in red and adds a javascript onclick handler (no event trapping!) etc if you put it on a php 5+ server and provide URL=<something> in the query string. Doesn't use XLST, (too site specific) but uses XPath, and can be extended to inject code/content, reposition stuff on screen if you don't like the page layout etc Quote Link to comment Share on other sites More sharing options...
cooper Posted March 8, 2007 Share Posted March 8, 2007 I'm pretty sure the Analog.5 crew would *LOVE* to see an article about that. Quote Link to comment Share on other sites More sharing options...
psychoaliendog Posted March 8, 2007 Share Posted March 8, 2007 Thats cool, It would make for interesting article. XSLT, along with XPath and XSL-FO, is a subset of XSL. XSLT is a scripting language that takes an XML Document and transforms it in to another Document, not necessarily XML. This case you're going from HTML to HTML. It doesn't have to be site specific, its the programmers choice. Quote Link to comment Share on other sites More sharing options...
wakes Posted March 8, 2007 Author Share Posted March 8, 2007 Ok, I'll put a proposal together to the analog.5 guys. Anything you think would be cool to include? (Excluding global peace, free beer for all etc). Quote Link to comment Share on other sites More sharing options...
a5an0 Posted March 9, 2007 Share Posted March 9, 2007 go for it. Quote Link to comment Share on other sites More sharing options...
deleted Posted March 9, 2007 Share Posted March 9, 2007 kl :D :D Quote Link to comment Share on other sites More sharing options...
Neondog82 Posted March 9, 2007 Share Posted March 9, 2007 Like other people have mentioned, I have no idea what the heck you are talking about. However since I don't know jack, any information is a step in the right direction. I look forward to it. Quote Link to comment Share on other sites More sharing options...
Guest ciri Posted March 10, 2007 Share Posted March 10, 2007 Sounds interesting. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.