Re: Help taking a string from a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux