Question: ```
<toplevel>
 <CompleteSuggestion>
  <suggestion data="shook ones part 2"/>
 </CompleteSuggestion>
 <CompleteSuggestion>
  <suggestion data="shook me all night long"/>
 </CompleteSuggestion>
 <CompleteSuggestion>
  <suggestion data="shook ones instrumental"/>
 </CompleteSuggestion>
 <CompleteSuggestion>
  <suggestion data="shook me all night long lyrics"/>
 </CompleteSuggestion>
</toplevel>

```

I want to extract "shook ones part 2" from this XML output. I have gone through every solution, but I'm unable to do this.
I tried this:

```
<?php
$url = 'http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=shook&ds=yt';
$exact = simplexml_load_file($url);
echo $exact->CompleteSuggestion[0]->suggestion;
?>

```

Answer: 
`shook ones part 2` is value of an attribute `data` of `suggestion`.
So you should get all attributes of a `suggestion` with function `attributes()` and select `data`:

```
$exact = simplexml_load_file('$url');
echo $exact->CompleteSuggestion[0]->suggestion->attributes()->data;

```
Omit the single quotes in 

```
simplexml_load_file('$url');
                    ^    ^

```