Re: Parsing remote sites
| From: | Hans H. Anderson | Date: | Thu, 07 Sep 2000 19:37:12 +0000 |
| Subject: | Re: Parsing remote sites | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15768@lists.php.net to get a copy of this message | ||
Robert,
See the docs about ereg() and preg(). Here's a quick example of how to
get the address, using your example string:
$s = "Name: John
Address: 456 Main Street";
eregi("address: *(.*)",$s,$m);
print $m[1]; // prints 456 Main Street
Hans
On Thu, 7 Sep 2000, Robert Abbate wrote:
> Hi. I have been able to fetch content from other sites (using a PHP script
> called "Snoopy"), and print it, but I want to be able to recognize certain
> words and don't really know where to begin.
>
> For example: Let's say the site I fetch has:
>
> "Name: John
> Address: 456 Main Street"
>
> Is there a way to get PHP to recognize certain words (like: "Address" in
> this case) and be able to plug in the result (in this case: 456 Main
> Street)??
>
> Any help would be appreciated. I really don't know where to begin on this
> one.
>
> Thanks!
>
>
>
>
>
--
Hans Anderson -=-
me@hansanderson.com | PHP, SQL Databases, Flash 5 Animation
http://www.hansanderson.com | & Programming, Killer
Audio Production,
http://www.goofiness.com | Search Engines, Brewmeister.