?
Solved

How can I parse flashvars from EMBED tag string?

Posted on 2011-04-27
8
Medium Priority
?
736 Views
Last Modified: 2012-05-11
I have the EMBED string like this and want to get only the flashvars variable as itemId=OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09 .. i need only "OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09" .. how can i read this from the below attached string?
<embed src='http://www.test.com//test_1.swf' quality="high" FlashVars="itemId=OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09&autoplay=0&duration=02:45&url=http://test.com" bgcolor="#ffffff" wmode="opaque" width="320" height="65" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>

Open in new window

0
Comment
Question by:Loganathan Natarajan
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35481301
First, I feel you have posted in the wrong zone, so kindly update the zones to Adobe Flash/ActionScript.
Now, if you are using AS2, then do this to get the itemId:

var itemId:String= _root.itemId;

For AS3:
var itemId:String = loaderInfo.parameters.itemId;


Hope this helps.

Warm Regards
Deepanjan Das
0
 
LVL 36

Author Comment

by:Loganathan Natarajan
ID: 35481329
No, I am looking some preg_match way to parse or split the above EMBED tag.
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35481441
Opps I am sorry :)

Not sure about the php method much but with javascript try this logic:
Split by "itemId=" and then again split the second element by "&" to get the itemId value.

Warm Regards
Deepanjan Das
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 35481489
Find string position of the first equal char "=" and then sub string the value to get the value after the first equal "=".
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 35481846
Use something familiar to the following:
var i = myString.indexOf("=");
myString = myString.substr(i, myString.length);

Open in new window

0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 1000 total points
ID: 35482728
Try this:
preg_match('/flashvars="[^"]*itemId=([^&"]+)/i', $sourceString, $match);
echo $match[1];

Open in new window

0
 
LVL 36

Author Closing Comment

by:Loganathan Natarajan
ID: 35482820
thank you
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35483486
NP. Glad to help  : )
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this article, we’ll look at how to deploy ProxySQL.
The viewer will learn how to dynamically set the form action using jQuery.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month16 days, 1 hour left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question