digian Posted December 27, 2008 Share Posted December 27, 2008 Hi, first sorry, my English is not so good... i'm working on a facebook application and i need to match the user id with picture and name from an url like http://www.facebook.com/profile.php?id=1447195962 Tried in many way but i always get just the name instead of the pic and nothing more. Can someone please help me? Thanks, this is my code preg_match("/<a id=\href=\"http:\/\/www.facebook.com\..*?id=$fid\">.*?<\s*img [^\>]*src=\"([^\">]+)/is",$hold,$match); $pic_url = $match[1]; } if(empty($name)) { preg_match("/<span class=\"nametext \">(.*)<\/span>/",$hold,$match); $name = $match[1]; } if(empty($name)) { preg_match("/<span class=\"nametext \">(.*)<\/span>/",$hold,$match); $name = $match[1]; } if(empty($pic_url)) { $hold=eregi_replace("<img class=\"image \" alt=\"photo\" src=\"","<img border=\"0\" alt=\"\" src=\"",$hold); $photourl=explode("<img border=\"0\" alt=\"\" src=\"",$hold);$photourl=explode("\"",$photourl[1]);$photourl=$photourl[0]; if(eregi("profile.ak.facebook.com",$hold)) {$photourl=explode("profile.ak.facebook.com",$hold);$photourl=explode("\"",$photourl[1]);$photourl=$photourl[6];} $pic_url = $photourl; } Link to comment https://forums.phpfreaks.com/topic/138583-help-for-preg_match/ Share on other sites More sharing options...
laffin Posted December 27, 2008 Share Posted December 27, 2008 and how is preg_match supposed to extract the information? if the information isnt in the link u provided? http://www.facebook.com/profile.php?id=1447195962 See no name, just userid u wuf prolly have to use curl or fopen in order to retrieve the page and parse the page itself, or see if ya can get a redirected url link instead as they do http://it-it.facebook.com/people/Leila-Mod/1447195962 which has their name and userid. Link to comment https://forums.phpfreaks.com/topic/138583-help-for-preg_match/#findComment-724662 Share on other sites More sharing options...
digian Posted December 27, 2008 Author Share Posted December 27, 2008 Thanks for reply, if i type that link i see the search page with name and profile picture...this is what i need to get Link to comment https://forums.phpfreaks.com/topic/138583-help-for-preg_match/#findComment-724665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.