Jump to content

Decoded String


Matrixkid

Recommended Posts

Hey guys

 

Ive been trying for a couple hours now to parse a data string but Im having no luck.

 

I have the following:

[ "\x3cdiv class=\"medium-content-below-item\"\x3e\n  \x3cdiv class=\"desc\"\x3e\n
                    \x3ch3 class=\"medium-content-below-item-title\"\x3e\x3ca class=\"title_link\" href=\"music/albums/1633820\"\x3e\n                  
\x3cspan \x3eEmpire State Of Mind\x3c/span\x3e\n                
\x3c/a\x3e\x3c/h3\x3e\n                \n                    \x3ca href=\"music/artists/195154/jay-z\"\x3e\n             
\x3cdiv class=\"medium-content-below-item-subtitle\"\x3eJay-z\x3c/div\x3e\n                
\x3c/a\x3e\n                \n         
\x3cdiv class=\"medium-content-below-item-time\"\x3e10:32pm\x3c/div\x3e\n        \n        \n     
\x3c/div\x3e\n\x3c/div\x3e\n" ]

 

Ive tried preg_replace, str_replace and nothing works. if i try using ">" or "<" it doesnt replace, nor does "\x3c" or "\x3e"

 

In the end, im looking to just replace everything so im left with

Empire State of Mind - Jay-z - 10:32pm

 

If someone could help me just getting a str_replace or something like that to work that would be great.

 

Thanks

MK

 

Link to comment
Share on other sites

something like this ?

 

<?php
$str = "\x3cdiv class=\"medium-content-below-item\"\x3e\n  \x3cdiv class=\"desc\"\x3e\n                    \x3ch3 class=\"medium-content-below-item-title\"\x3e\x3ca class=\"title_link\" href=\"music/albums/1633820\"\x3e\n                  \x3cspan \x3eEmpire State Of Mind\x3c/span\x3e\n                \x3c/a\x3e\x3c/h3\x3e\n                \n                    \x3ca href=\"music/artists/195154/jay-z\"\x3e\n              \x3cdiv class=\"medium-content-below-item-subtitle\"\x3eJay-z\x3c/div\x3e\n                \x3c/a\x3e\n                \n          \x3cdiv class=\"medium-content-below-item-time\"\x3e10:32pm\x3c/div\x3e\n        \n        \n      \x3c/div\x3e\n\x3c/div\x3e\n";

echo strip_tags(html_entity_decode($str));

?>

Link to comment
Share on other sites

yep, here it is:

 

$html = '[ "\x3cdiv class=\"medium-content-below-item\"\x3e\n  \x3cdiv class=\"desc\"\x3e\n
                    \x3ch3 class=\"medium-content-below-item-title\"\x3e\x3ca class=\"title_link\" href=\"music/albums/1633820\"\x3e\n                 
\x3cspan \x3eEmpire State Of Mind\x3c/span\x3e\n               
\x3c/a\x3e\x3c/h3\x3e\n                \n                    \x3ca href=\"music/artists/195154/jay-z\"\x3e\n             
\x3cdiv class=\"medium-content-below-item-subtitle\"\x3eJay-z\x3c/div\x3e\n               
\x3c/a\x3e\n                \n         
\x3cdiv class=\"medium-content-below-item-time\"\x3e10:32pm\x3c/div\x3e\n        \n        \n     
\x3c/div\x3e\n\x3c/div\x3e\n" ]';

		$string = str_replace("]","",$html);
		$string = str_replace("[","",$string);

		echo strip_tags(html_entity_decode($string));

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.