Muncey Posted May 30, 2008 Share Posted May 30, 2008 Hi, was planning on making a bbcode and i wanted to know how to get data from a site. For example a site displays information about albums. Link example: albumsite.com/albumname/ Each album has it's own page but all the pages are layed out the same... for example: Artist: Name here Album Title: Title here Year: Year here ect. How do i pull the data out of artist/album title ect depending on what is put inbetween the bbcode. [album]albumname[/album] Hope that makes sense, Thanks in advanace. Link to comment https://forums.phpfreaks.com/topic/108063-getting-information-from-other-sites/ Share on other sites More sharing options...
BillyBoB Posted May 30, 2008 Share Posted May 30, 2008 Are you looking to pull the [album]_____[/album] or are you looking for an answer on how to pull data from another site? Link to comment https://forums.phpfreaks.com/topic/108063-getting-information-from-other-sites/#findComment-553899 Share on other sites More sharing options...
Muncey Posted May 30, 2008 Author Share Posted May 30, 2008 Pull the data from another site. So when [album]____[/album] is put in the part inbetween the album brackets is taken and put into the url and then it takes the relevant data from the url. EG. [album]RandomName[/album] Would get data from www.albumsite.com/RandomName/ and it would then take the information from there. Link to comment https://forums.phpfreaks.com/topic/108063-getting-information-from-other-sites/#findComment-553903 Share on other sites More sharing options...
BillyBoB Posted May 30, 2008 Share Posted May 30, 2008 I don't know if you want me to tell you how to get the info between the bbcode or get the file info on the url. Link to comment https://forums.phpfreaks.com/topic/108063-getting-information-from-other-sites/#findComment-553905 Share on other sites More sharing options...
Muncey Posted May 30, 2008 Author Share Posted May 30, 2008 Both lol, you use the info between the bbcode. For example... [bbcode]test[/bbcode] Then $a = "www.randomsite.com/ ".$x Where $x = the data between the bbcode.. in this case it would be test. After that you take $a and gather the information from the url. So you'd find "Title:" and get the information after that... Link to comment https://forums.phpfreaks.com/topic/108063-getting-information-from-other-sites/#findComment-553908 Share on other sites More sharing options...
BillyBoB Posted May 30, 2008 Share Posted May 30, 2008 Ok, well to get the info between is easy (only because I also just made a bbcode parser ). <?php $text = "[album]name[/album]"; $i = 0; preg_match_all("/\[album\](.+)\[\/album\]/U", $text, $matches); while($matches[0][$i]!='') { echo $matches[1][$i]; $i++; } And for the gathering info look at the php manual file_get_contents. Link to comment https://forums.phpfreaks.com/topic/108063-getting-information-from-other-sites/#findComment-553914 Share on other sites More sharing options...
Muncey Posted May 31, 2008 Author Share Posted May 31, 2008 Thanks a lot! Will check out the link. Link to comment https://forums.phpfreaks.com/topic/108063-getting-information-from-other-sites/#findComment-554124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.