|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Regular Expression Desperation. I'll PayPal $10 to whoever get's it working properly.
For someone who knows what their doing this shouldn't be too hard; unfortunately for me, this my first time using regular expressions, and I don't have the luxury, or patience to learn them right now.
I'll send $10 USD to anyone who gets it working the way I want. (I'll be sending it through Pay Pal, so you may need to have a premier account, I'm not sure.) I have written out a detailed explanation of the problem, with examples of what I need it to do. Please test it using the url http://www.yahoo.com. It has 3 JavaScript code blocks separated by text, so this will be a good test page for multiple uses of JavaScript. The other page is http://www.brainhosting.com. They have one JavaScript code block at the top, so this will be a good test page for just one. The first person to post the working code is the winner. If it doesn't work, I'll move on until I get one that does work. (So please test it yourself before you post it) Disclaimer: You agree to not try and hold any property rights to the regular expression, and that it shall be 100% royalty free. (I've learnt the hard way to cover my butt) Please visit http://www.arcanenexus.com for a more detailed explination. Thanks to all who help, and congrats to the first to get it working. |
|
#2
|
|||
|
|||
|
Hi
Try something like this.... untested but it should work! PHP Code:
F! |
|
#3
|
|||
|
|||
|
It poduced an error
|
|
#4
|
||||
|
||||
|
preg_replace needs to be set to ignore newlines. The '/s' modifier does it.
Code:
<?php
$domain = 'http://www.yahoo.com/';
$open = fopen($domain, "r");
$readone = fread($open, 200000);
$readtwo = stristr($readone, '<body');
$readthree = preg_replace( "/<script[^>]+>.*?<\/script>/is", "", $readtwo); //<-- extra modifier here
//$readthree = eregi_replace("<script(.*)<\/script>/u", "", $readtwo);
$read = strip_tags($readthree);
fclose($open);
$filtered = eregi_replace(" a ", " ", $read);
$$filtered = eregi_replace(" about ", " ", $filtered);
$$filtered = eregi_replace(" after ", " ", $$filtered);
$$filtered = str_replace('"', ' ', $$filtered);
echo trim($$filtered);
?>
|
|
#5
|
|||
|
|||
|
Thanks kurious, it did everything I needed it to do. I've tested it on 5 five sites and were formatted perfectly. (well, still a few bugs to work out, the source of the formatted pages have a LOT of white space)
Send me your Pay Pal details. (sales@arcanenexus.com) and I'll send you all money as I said I would. Thanks again. |
|
#6
|
||||
|
||||
|
>Send me your Pay Pal details.
That's not necessary. It's the season of good will ![]() If you feel the need to pay, you can buy something for rycamor He's helped me out a lot and has an Amazon wishlist at http://www.amazon.com/gp/registry/r...id=HBFZZHYLLOGH Last edited by kurious : December 17th, 2003 at 04:40 PM. |
|
#7
|
|||
|
|||
|
Thanks,
I'll browse around for a book for my friend. |
|
#8
|
|||
|
|||
|
Hi
First off, WHAT ERROR DID IT GIVE YOU, you say it gave you a error, but you don't say what the error is! After trying my code on 3 servers I see no error, I think you full of bull! http://ms.ya-right.net/yahoo.php F! |
|
#9
|
|||
|
|||
|
Fatal error: Call to undefined function: file_get_contents() in c:\phpdev\www\test.php on line 28
This line specifically $page = file_get_contents('http://www.yahoo.com/'); Tested on a windows box |
![]() |
| Viewing: Dev Shed Forums > Other > Hire A Programmer > Regular Expression Desperation. I'll PayPal $10 to whoever get's it working properly. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|