Hébergements Web - Web service: json_encode
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Frage

Web service: json_encode

Von
RonaldJ
Erstellungsdatum 2018-05-17 10:53:55 (edited on 2024-09-04 12:13:57) in Hébergements Web

Bonjour,
J'ai développé un web service en php et j'ai publié les service avec json_encode.
Lorsque je travail en local, tout marche parfaitement bien, mais dès que je transmets le web service sur mon domaine OVH je rencontre beaucoup de problèmes.
Je m'explique:
Lorsque je fais json_encode(un_objet) la chaine s'affiche correctement.
mais des que j'essaie de publier une liste ou un tableau il m'envoie une page blanche.
Tout marche bien en local mais sur le serveur ça pose des problèmes.

En local ça marche mais sur le server les caractères spèciaux posent de problème.

Quelqu'un pour m'aider svp.

Je vous remercie par avance.


2 Antworten ( Latest reply on 2018-05-17 16:44:02 Von
Gaston_Phone
)

Bonjour @RonaldJ, qu'utilises-tu comme CHARSET dans les tables ta base de données ?

j'utilise utf-8 en ajoutant cette ligne
header("Content-Type: application/json; charset=utf-8");

bonjour @Gaston_Phone,

j'utilise utf-8 en ajoutant cette ligne
header("Content-Type: application/json; charset=utf-8"); dans le script php
et dans phpmyadmin j'utilise utf8mb4_unicode_ci


j'utilise utf-8 en ajoutant cette ligne
header("Content-Type: application/json; charset=utf-8"); dans le script php
et dans phpmyadmin j'utilise utf8mb4_unicode_ci

Bonjour @RonaldJ tu n'as pas répondu à ma question.

Exemple de ce que j'ai :
CREATE TABLE `Tab_test_DB` ( `Id` int(11) NOT NULL auto_increment, `NOM` varchar(32) NOT NULL default '', `PRENOM` varchar(32) NOT NULL default '', PRIMARY KEY (`Id`)) **_ENGINE=MyISAM DEFAULT CHARSET=latin1_**

Tu devrai tester ceci : **1https://wordetweb.com/word-et-web/OVH-Tester-une-base-de-donnees-via-un-script-PDO-FR.htmhttps://wordetweb.com/word-et-web/OVH-Tester-une-base-de-donnees-via-un-script-PDO-FR.htm OVH - Test de Base de Données via un script en langage PDO_**