Bonjour,
après avoir fait une requête cURL en php auprès d'un serveur, je reçois les données demandées au format json.
je cherche maintenant a lire une variable en particulier mais je n'arrive pas a formuler correctement en php pour accéder à cette variable.
voilà les données reçu:
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 <pre class='xdebug-var-dump' dir='ltr'> <small>C:\wamp64\www\sites\fdgdfgdfgdfr\xxxx.php:85:</small> <b>object</b>(<i>stdClass</i>)[<i>12</i>] <i>public</i> 'Count' <font color='#888a85'>=></font> <small>int</small> <font color='#4e9a06'>1</font> <i>public</i> 'Data' <font color='#888a85'>=></font> <b>array</b> <i>(size=1)</i> 0 <font color='#888a85'>=></font> <b>object</b>(<i>stdClass</i>)[<i>13</i>] <i>public</i> 'CreatedAt' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'2021-07-07T19:39:38Z'</font> <i>(length=20)</i> <i>public</i> 'DeliveredCount' <font color='#888a85'>=></font> <small>int</small> <font color='#4e9a06'>0</font> <i>public</i> 'Email' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'aaaaaaaaa@hotmail.com'</font> <i>(length=26)</i> <i>public</i> 'ExclusionFromCampaignsUpdatedAt' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i> <i>public</i> 'ID' <font color='#888a85'>=></font> <small>int</small> <font color='#4e9a06'>22483524</font> <i>public</i> 'IsExcludedFromCampaigns' <font color='#888a85'>=></font> <small>boolean</small> <font color='#75507b'>false</font> <i>public</i> 'IsOptInPending' <font color='#888a85'>=></font> <small>boolean</small> <font color='#75507b'>false</font> <i>public</i> 'IsSpamComplaining' <font color='#888a85'>=></font> <small>boolean</small> <font color='#75507b'>false</font> <i>public</i> 'LastActivityAt' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i> <i>public</i> 'LastUpdateAt' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i> <i>public</i> 'Name' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'gsdffdgsggdfgdfgs'</font> <i>(length=10)</i> <i>public</i> 'UnsubscribedAt' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i> <i>public</i> 'UnsubscribedBy' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i> <i>public</i> 'Total' <font color='#888a85'>=></font> <small>int</small> <font color='#4e9a06'>1</font> </pre><br />
et le var_dump en php suivi de la tentative d'accès a la variable "Email" qui ne fonctionne pas:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 $reponse = json_decode($reponse); var_dump($reponse); echo $reponse->Data->stdClass->Email;
Est ce que quelqu'un peut me dire comment formuler ce dernier "echo", j'ai essayer plusieurs tournures avec des choses du type ['Email"] mais sans succès.
Merci d'avance
Partager