0

Try this query:

http://www.dictionaryapi.com/api/v1/references/collegiate/xml/gobabola?key=135a6187-af83-4e85-85c1-1a28db11d5da

How do I simply read in the suggestions as variables? I can't seem to find anything that explains this.

2

1 Answer 1

1

You can use SimpleXmlIterator. That's really easy to use and you will be able to perform a foreach on the object you will get.

Library source

For example with file_get_contents or replace with curl if you prefer:

    $feed = new SimpleXmlIterator(file_get_contents('http://www.dictionaryapi.com/api/v1/references/collegiate/xml/gobabola?key=135a6187-af83-4e85-85c1-1a28db11d5da'));
    foreach ($feed->suggestion as $suggestion) {
        echo $value;
      }
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.