0
yahoo api에 대해 message 오류가 발견되었습니다. 한계를 초과하면 누구나 Json 객체로 반환 할 항목과 XML 형식으로 표시하지 않을 항목을 알 수 있습니까? geocoder gemyahoo API에서 한도 초과 오류 코드 또는 ErrorMessage가 JSONObject로 검색되는 이유는 무엇입니까?
##
# Yahoo returns errors as XML even when JSON format is specified.
# Handle that here, without parsing the XML
# (which would add unnecessary complexity).
# Yahoo auth errors can also be cryptic, so add raw error desc
# to warning message.
#
def parse_raw_data(raw_data)
if raw_data.match(/^<\?xml/)
if raw_data.include?("Rate Limit Exceeded")
raise_error(Geocoder::OverQueryLimitError) || warn("Over API query limit.")
elsif raw_data =~ /<yahoo:description>(Please provide valid credentials.*)<\/yahoo:description>/i
raise_error(Geocoder::InvalidApiKey) || warn("Invalid API key. Error response: #{$1}")
end
else
super(raw_data)
end
end
에서
안녕하세요, PHP 용 코드 샘플이 있습니까? – vini
@ vini 불행히도 PHP를 많이 작성하지는 않지만 XML 응답을 구문 분석하기가 너무 어려워서는 안됩니다. – engineersmnky