Jump to content

Content extraction


CodilX

Recommended Posts

Hi again :)

Now I'm having trouble extracting a portion of content out of page. Basicly it looks like this:

[code]
some content
..
..
<img src="someimage.jpg">
multiple lines of content that I want to extract
...
<div id="something">
.. some content
[/code]

I'm trying to do it with [b]if (stristr($text, "<img src="someimage.jpg">")) {[/b] .. but with no luck :(

Can somebody help me with this?

Thx - Matt
Link to comment
Share on other sites

[!--quoteo(post=385295:date=Jun 18 2006, 05:27 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 18 2006, 05:27 PM) [snapback]385295[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You may want to use regex:

[code]preg_match('/<img src="someimage.jpg">(.*?)<div id="something">/', $string, $matches);

echo '<pre>';
print_r($matches);
echo '</pre>';[/code]
[/quote]

Thx alot, but it doesn't go with my code. Could you write that with the connection to the site?

I get an error:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Warning: preg_match() [function.preg-match]: Unknown modifier 't' in ...*.php on line 5

Array
(
)
[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.