aliasnille / pap-api

DEPRECATED Open API that checks and verifies Swedish addresses and postal codes.
https://www.papapi.se/
MIT License
28 stars 0 forks source link

Malformed response when trying to validate address #4

Open shachibista opened 6 years ago

shachibista commented 6 years ago

When trying to validate an address:

curl -v "https://papapi.se/json/?token=<TOKEN>&v=sdf|sdf|sdf|sdf" (address is clearly invalid)

The response is:

< HTTP/1.1 200 OK
< Date: Fri, 10 Aug 2018 16:52:06 GMT
< Server: Apache
< X-Powered-By: PHP/5.5.38
< Access-Control-Allow-Origin: *
< Pragma: public
< Cache-control: private
< Expires: -1
< Upgrade: h2,h2c
< Connection: Upgrade
< Transfer-Encoding: chunked
< Content-Type: application/json; charset=utf-8
< 
<br />
<b>Warning</b>:  mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in <b>/[redacted]/index.php</b> on line <b>743</b><br />
<br />
<b>Warning</b>:  mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in <b>/[redacted]/index.php</b> on line <b>753</b><br />
<br />
<b>Warning</b>:  mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in <b>/[redacted]/index.php</b> on line <b>763</b><br />
* Connection #0 to host papapi.se left intact
{"api":{"name":"PAP-API","url":"HTTPS://WWW.PAPAPI.SE/","version":"1.22","encoding":"UTF-8"},"result":{"address":{"street":"SDF","number":"sdf","zipcode":"sdf","city":"SDF"},"status":{"code":"100","description_sv":"KORREKT ANGIVEN ADRESS","description_en":"CORRECT SPECIFIED ADDRESS"}}}

Note two issues:

  1. The JSON response is tainted by PHP warning
  2. The response says the address is "CORRECT SPECIFIED ADDRESS" even though it is clearly incorrect.