Minklet Posted February 9, 2011 Share Posted February 9, 2011 I have a app that allows peope to add embed codes to a database. I basically preg match 3 things from the code and then add it to my own string and add that to the database. Unfortunately Soundcloud seems to keep changing their embed code and I can't get this one to match I need to match this: <object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F10218120"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F10218120" type="application/x-shockwave-flash" width="100%"></embed> </object> <span><a href="http://soundcloud.com/ballen/ballen-february-mix">Ballen February Mix</a> by <a href="http://soundcloud.com/ballen">B'allen</a></span> and I am trying to use this: ~^<object height="(\d{2,3})" width="(\d{2,3})%">\s*' . '<param name="movie" value="(http://player\.soundcloud\.com/player\.swf\?url=http%3A%2F%2Fapi.soundcloud\.com%2Ftracks%2F[\w-%])"></param>\s*' . '<param name="allowscriptaccess" value="always"></param>\s*' . '<embed allowscriptaccess="always" height="\1" src="\3" type="application/x-shockwave-flash" width="\2%"></embed>\s*' . '</object>\s*<span><a href="(.*?)">(.*?)</a>(.*?)<a href="(.*?)">(.*?)</a></span>$~ I've honestly been trying for about 4 hours and I simply cannot see what I have got wrong. Any help whatsoever would be fantastic Quote Link to comment Share on other sites More sharing options...
Minklet Posted February 9, 2011 Author Share Posted February 9, 2011 If this helps this: <object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F758467%3Fsecret_token%3Ds-f6d9b&secret_url=false"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F758467%3Fsecret_token%3Ds-f6d9b&secret_url=false" type="application/x-shockwave-flash" width="100%"></embed> </object> <span><a href="http://soundcloud.com/generalpie/june-09-chilled-soulful-dubstep-and-garage-mix">June 09 Chilled/Soulful Dubstep and Garage Mix</a> by <a href="http://soundcloud.com/generalpie">GeneralPie</a></span> matches with this: ~^<object height="(\d{2,3})" width="(\d{2,3})%">\s*' . '<param name="movie" value="(http://player\.soundcloud\.com/player\.swf\?url=http%3A%2F%2Fapi.soundcloud\.com%2F[\w-%]+&secret_url=(?:false|true))">\s*</param>\s*' . '<param name="allowscriptaccess" value="always">\s*</param>\s*' . '<embed allowscriptaccess="always" height="\1" src="\3" type="application/x-shockwave-flash" width="\2%">\s*</embed>\s*' . '</object> <span><a href="(.*?)">(.*?)</a>(.*?)<a href="(.*?)">(.*?)</a></span>$~ 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.