function unhtmlentities

Djunity

Verified User
Joined
Mar 9, 2008
Messages
243
Location
Holland
Hi all,

On the api explenation page on da website http://www.directadmin.com/api.html there is an description on you to parse the api out put with: unhtmlentities and parse_str()

I have the function:
PHP:
function unhtmlentities($string) {
		return preg_replace('~&#([0-9][0-9])~e', 'chr(\\1)', $string);
	}

In my script but when i get a response from CMD_API_DOMAIN like:
error=0&text=Your default domain has been set&details=yourdomain.com is now your default domain.&#60br&#62/&#126user will now point to yourdomain.com

After running unhtmlentities and parse_str() the result is like:
array(1) {
[0]=>
array(3) {
["error"]=>
string(1) "0"
["text"]=>
string(32) "Your default domain has been set"
["details"]=>
string(101) "yourdomain.com is now your default domain.
/ 6user will now point to yourdomain.com"
}
}

Your can see that the homepage link is pointed as /6user it should be /~user.

Anyone know how to adjust unhtmlentities to fix this issue im not that good with regex
 
Back
Top