Q:

php scraping attribute string object model

in the site web the are this html:
<li class="foo" data-link="{"ke1":"val1","key2":"val2","key3":"val3"}" >text</li>

I should recover the value of "key3" of "data-link" ("val3") and "text"
i use this code (php):
$html = file_get_contents('http://siteweb.com');
$foo = new DOMDocument();

libxml_use_internal_errors(TRUE); 

if(!empty($html)){ 

    $foo->loadHTML($html);
    libxml_clear_errors(); 

    $foo_xpath = new DOMXPath($foo);

    $foo_row = $foo_xpath->query('//li[@data-link]');

    if($foo_row->length > 0){
        foreach($foo_row as $row){
            $value = $row->getAttribute('data-slink');
            echo $value; //{"ke1":"val1","key2":"val2","key3":"val3"}

            echo $row->nodeValue . "<br/>"; //text
        }
    };

what code to use to do this?

A:

Seems that can be parsed by json_decode.
http://php.net/manual/en/function.json-decode.php
```

$link = json_decode($value,true);
echo $link['key3'];
```

