The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
PHP Filtering some html...
Hi all. Not strictly a vb or even PHP question this, but I'm looking for some pointers to somewhere more appropriate if needs be.
Would it be possible to make a script that you give a parameter of an external webpage, it filters it somehow and then renders it? I'm looking to make a custom script to rip out some adverts and and side bar from a webpage (no, it's not any vbulletin page, don't worry ). It would basically read the webpage's html like a string, snip any content between the code I'll identify as 'ad code begins' and 'ad code ends' and then render the page. Possibly I'd like to replace the content, but one step at a time. I was inspired to this idea by pages such as http://www.pornolize.com/ , who seem to process webpages with finds and replaces without much apparent difficulty, though I don't know what sort of scripts they're running. Could anyone point me in the right direction? |
#2
|
||||
|
||||
It would be possible (if I understand you right) - however it would be a nightmare to do.
Based on my understanding, you would need a script to: open a URL and get its contents. Loop through the lines and strip out the headers and build 1 big string. Search and replace whatever you are trying to replace (which isn't as easy as it sounds) Then push it down to whoever asked for it. That would take at least 3 times longer then rendering a page to them and take twice as much bandwidth. I don't mean to be all negative Nancy and stuff. Just trying to point out the overheads of what you are trying to accomplish. Heres a link for the fopen function that would fetch the page for you -> http://uk.php.net/manual/en/function.fopen.php |
#3
|
|||
|
|||
^ ^
thanks a lot, I'll be investigating that now! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|