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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.