On 4/12/06, Chris Westbrook <[EMAIL PROTECTED]> wrote:
> I have a problem.  I'm trying to get a Google search results page via snoopy
> and then display the links of the results it returns in an application.  I
> know about the fetchlinks function in snoopy, but I'm having trouble getting
> the text between the <a> and </a> tags.  Yeah, I know, I should use the
> Google API, but my client doesn't want me doing that, probably because they
> might have to pay for that.  any suggestions?

Try this, and read up on regular expressions - it's an essential
knowledge if you're a programmer.

$text = "this is where the contents of your search result page goes";
preg_match_all('|<a[^>]*href="([^"]+)"[^>]*>([^<]+)<\/a>|U', $text,
$links, PREG_SET_ORDER);
print_r($links);

--
Kim Christensen
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to