below is a snippet from a larger code used to capture a daily output graphic
file from a site...  I put your requirements into it and removed a lot of
superfluous stuff, but it is not set to capture text spanning more than one
line, but you should be able to modify it accordingly if you can follow the
logic.

>on 8/2/01 5:30 PM, Chuck Barnett at [EMAIL PROTECTED] wrote:
>
>> Hi I have a question about parsing a page on another server to grab some
>> headlines.
>>
>> I want to search down the page until I find a string "-headlines-" then I
>> want to grab everything between the next pair of <table></table> tags.
>>
>> Anyone have a quick solution?
>
>i would check out http://php.net/strpos
>

<?PHP
/*
        HTML Content Grabber

        no copyright
*/
$file_url = "http://www.somewhere.com/";;
$grabbed_file = file($file_url);
if ($grabbed_file[0]) {
        for ($i = 0; $i <= count($grabbed_file) - 1; $i++) {
                if($returnstr = strstr ($grabbed_file[$i], '-headlines-')) {
                        $trim = substr ($returnstr, strpos($returnstr,
'<table>')+7,strpos($returnstr, '</table>')-(strpos($returnstr, '<table>')+7));
                }else{
                        # not in this line, keep searching
                }
        }
} else {
        # Something went wrong
}
?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to