Re: Help taking a string from a file

From: Date: Mon, 16 Jan 2006 07:10:00 +0000
Subject: Re: Help taking a string from a file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228641@lists.php.net to get a copy of this message
On Sat, Jan 14, 2006 at 09:03:24AM -0700, Lists wrote: > > My goal is to take just the HTML for the image and link from the > Flickr badge js script. > ... > > <? > // allow retrieval of external web source > ini_set('allow_url_fopen',1); > > // get flickr js file > $photo = > file_get_contents("http://www.flickr.com/badge_code_v2.gne? > count=1&display=latest&size=m&layout=h&source=user&user=91667218% > 40N00"); > > //get rid of all the crap except for the image tags > ... You're best aproach would be to look fo what you want. If all you have to work with is some poorly written html doc and you want the <a> <img> tag important parts? preg_match('/<a href="([^"]+)".*?><img src="([^"]+)"/, $photo, $matches); var_dump($matches); Otherwise contact flicker and ask them for an API for what you are trying to do. And if the above works dont expect it to work all the time. Curt. -- cat .signature: No such file or directory -- cat .signature: No such file or directory

« previous php.general (#228641) next »