dingus Posted March 14, 2008 Share Posted March 14, 2008 hey i'm working with adbrite invideo today trying to design a easy to use script to work with there interface but i'm hitting walls left right and center i managed to get the reply from the server with curl now i have something that looks like this <addvideo> <type>success</type> <message><![CDATA[<script src="http://files.adbrite.com/player/js/abplayerlib.js" language="javascript"></script> <script language="javascript"> abWritePlayer(1674937, 468, 400, "http://vid.adbrite.com/video/abplayer?"); </script> <noscript> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="468" height="400" id="abPlayerObj" align="middle"><param name="movie" value="http://vid.adbrite.com/video/abplayer.swf?&vid=1674937&og=1" /><param name="quality" value="best" /><embed src="http://vid.adbrite.com/video/abplayer.swf?&vid=1674937&og=1" quality="best" width="468" height="400" name="abPlayerObj" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> </noscript>]]></message> <message>1674937</message> </addvideo> i need to extract the TYPE and the first message in to 2 different variables but once again its got me comply stuck can anyone offer some insight Quote Link to comment Share on other sites More sharing options...
lordfrikk Posted March 14, 2008 Share Posted March 14, 2008 This worked for me: <?php preg_match('/\<type>(.+)\<\/type>/', $variable, $match); echo $match[1]; preg_match('/\<message>(.+?)\<\/message>/', str_replace("\n", "", $variable), $match2); echo $match2[1]; ?> Quote Link to comment Share on other sites More sharing options...
dingus Posted March 14, 2008 Author Share Posted March 14, 2008 hey thanks for that really helpful 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.