selenin Posted June 10, 2011 Share Posted June 10, 2011 Hi First I make a file get contents and I get this <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007'><id>http://gdata.youtube.com/feeds/api/users/hellsehen33COM</id><published>2010-10-22T10:45:45.000-07:00</published><updated>2011-06-10T07:33:44.000-07:00</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#userProfile'/><category scheme='http://gdata.youtube.com/schemas/2007/channeltypes.cat' term='Standard'/><title type='text'>hellsehen33COM Channel</title><content type='text'>Join the youtube train video community at http://www.utubetrain.com</content><link rel='related' type='text/html' href='http://www.utubetrain.com'/><link rel='alternate' type='text/html' href='http://www.youtube.com/profile?user=hellsehen33COM'/><link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/users/hellsehen33COM'/><author><name>hellsehen33COM</name><uri>http://gdata.youtube.com/feeds/api/users/hellsehen33com</uri></author><yt:age>25</yt:age><yt:company>Spiritel</yt:company><yt:description>Join the youtube train video community at http://www.utubetrain.com</yt:description><gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.favorites' href='http://gdata.youtube.com/feeds/api/users/hellsehen33com/favorites' countHint='7'/><gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.contacts' href='http://gdata.youtube.com/feeds/api/users/hellsehen33com/contacts' countHint='29'/><gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.inbox' href='http://gdata.youtube.com/feeds/api/users/hellsehen33com/inbox'/><gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.playlists' href='http://gdata.youtube.com/feeds/api/users/hellsehen33com/playlists'/><gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.subscriptions' href='http://gdata.youtube.com/feeds/api/users/hellsehen33com/subscriptions' countHint='5'/><gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.uploads' href='http://gdata.youtube.com/feeds/api/users/hellsehen33com/uploads' countHint='7'/><gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.newsubscriptionvideos' href='http://gdata.youtube.com/feeds/api/users/hellsehen33com/newsubscriptionvideos'/><yt:gender>m</yt:gender><yt:location>CH</yt:location><yt:statistics lastWebAccess='2011-06-08T11:30:58.000-07:00' subscriberCount='10' videoWatchCount='0' viewCount='1550' totalUploadViews='1080'/><media:thumbnail url='http://i4.ytimg.com/i/7dhwlpv7R2qgw7XFivDuiw/1.jpg?v=a553d6'/><yt:username>hellsehen33COM</yt:username></entry>?> I need two thins of that not at the same time, first I need subscriberCount='10', but only the number, I tried it like that: $names = preg_match_all('/subscriberCount=\'(.*)\'/', $page_contents, $matches); print_r($matches); But it's not right I'm getting too much. The second I would need <media:thumbnail url='http://i4.ytimg.com/i/7dhwlpv7R2qgw7XFivDuiw/1.jpg?v=a553d6'/> Only the url of that. Quote Link to comment Share on other sites More sharing options...
selenin Posted June 10, 2011 Author Share Posted June 10, 2011 Okaj for the media:thumbnail, I made this: $names = preg_match_all('/<media:thumbnail url=["\'](.+?)["\']/', $page_contents, $matches); echo $matches[1][0]; and I get this: http://i4.ytimg.com/i/7dhwlpv7R2qgw7XFivDuiw/1.jpg?v=a553d6?> this one I'm close only the ?> in the end is too much Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted June 10, 2011 Share Posted June 10, 2011 "~subscriberCount='(\d+)'~" and "~media:thumbnail url='([^']+)'~" That should do it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.