Your code looks okay (some minor syntax issues, but nothing that looks like it'll break the script), so the issue could be with the returned data from the call to
$client->Companies();
.
Use this as a guide to check the XML returned from the Web Service to make sure it's not sending an empty character or anything that would break the parser:
http://stackoverflow.com/questions/15764748/start-tag-expected-not-found-in-sitemap-xml-not-sure-whats-wrong[
^].
Most of the time I see errors coming back from Web Services it's related to malformed XML that "looks okay" but there's a hidden character somewhere that's blowing it all up.