Jump to content

Can anyone see what I'm doing wrong?


Minklet

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/227184-can-anyone-see-what-im-doing-wrong/
Share on other sites

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>$~

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.