0

I'm trying to get from my database shop's latitude and longitude, but when i try to get the JSON response on my Android app i get the error:

com.android.volley.ParseError: org.json.JSONException: Value <html> of type java.lang.String cannot be converted to JSONArray

This is the JSON from my PHP file : http://comparateur.16mb.com/ShopGet.php

    [{"id":"1","nom":"Leclerc LE KREMLIN ","marque":"Leclerc","adressemag":"106 Avenue DE FONTAINEBLEAU 94276 LE KREMLIN BICETRE CEDEX ","latitude":"48.809081","longitude":"2.362206","lundi":"8h30 - 21h","mardi":"8h30 - 21h","mercredi":"8h30 - 21h","jeudi":"8h30 - 21h","vendredi":"8h30 - 21h","samedi":"8h30 - 21h","dimanche":"8h30 - 13h"},{"id":"2","nom":"Leclerc PANTIN","marque":"Leclerc","adressemag":"51 Avenue JEAN LOLIVE BP 64 ZAC ILOT 93503 PANTIN CEDEX ","latitude":"48.891099","longitude":"2.401926","lundi":"9h - 20h30","mardi":"9h - 20h30","mercredi":"9h - 20h30","jeudi":"9h - 20h30","vendredi":"9h - 20h30","samedi":"9h - 20h30","dimanche":"Ferme"}]
Ggs
  • 81
  • 2
  • 11
  • It seems that the problem is related with your server response. You are responding with an string instead a json. I suggest to change the html header to text/json and avoid the strange spaces at the begining of the response. – rdiaz82 Apr 05 '16 at 08:46

2 Answers2

2

Yes you have to either add ".php" at the end of the url in android side or configure htaccess in server side.

For htaccess: Redirect .php urls to urls without extension

Community
  • 1
  • 1
Prasanna Anbazhagan
  • 1,693
  • 1
  • 20
  • 37
1

You've got the wrong url, add .php to the url.

You're using http://comparateur.16mb.com/ShopGet but it should be http://comparateur.16mb.com/ShopGet.php

Tom Sabel
  • 3,935
  • 33
  • 45