-
-
Notifications
You must be signed in to change notification settings - Fork 158
Open
Labels
status:to be verifiedNeeds to be reproduced and validated.Needs to be reproduced and validated.type:bugBugBug
Description
I have this result from server:
<?xml version="1.0" encoding="UTF-8"?>
<yandexsearch version="1.0"><response date="20200221T142812"><error code="15">Для заданного поискового запроса отсутствуют результаты поиска.</error></response></yandexsearch>
$response->data return this array:
array(2) {
["@attributes"]=>
array(1) {
["version"]=>
string(3) "1.0"
}
["response"]=>
array(2) {
["@attributes"]=>
array(1) {
["date"]=>
string(15) "20200221T150244"
}
["error"]=>
string(119) "Для заданного поискового запроса отсутствуют результаты поиска."
}
}
code="15" is not in data array. I can get this code manually, but I think it would be better if it is in @attributes in data.
$xml = simplexml_load_string($response->content, 'SimpleXMLElement', LIBXML_NOCDATA);
$code = (string) $xml->response->error->attributes()->code;
Metadata
Metadata
Assignees
Labels
status:to be verifiedNeeds to be reproduced and validated.Needs to be reproduced and validated.type:bugBugBug