ウェブフックが私に提供したUR1にデータを送信しています。私はデータをキャッチしようとしています。 txtファイルに保存されてしまったデータはこれですwebhooksによって送信されたデータのデータを解析します。
if ($this->input->server('REQUEST_METHOD') == 'POST')
{
file_put_contents('test.txt', file_get_contents('php://input'));
......................
}
: - - を:これは私が使用していたコードである
今{
"created_at": "2017-04-04 12:03:07 UTC",
"href": "http://api.groovehq.com/v1/tickets/131",
"links": {
"customer": {
"id": "0454984580",
"href": "http://api.groovehq.com/v1/customers/[email protected]"
},
"drafts": {
"href": "http://api.groovehq.com/v1/tickets/131/drafts"
},
"state": {
"href": "http://api.groovehq.com/v1/tickets/131/state"
},
"messages": {
"href": "http://api.groovehq.com/v1/tickets/131/messages"
}
},
"number": 131,
"priority": "low",
"resolution_time": null,
"state": "unread",
"title": "gh",
"updated_at": "2017-04-04 12:03:07 UTC",
"system_updated_at": "2017-04-04 12:03:07 UTC",
"assigned_group_id": null,
"assigned_group": null,
"closed_by": null,
"tags": [
],
"mailbox": "Inbox",
"mailbox_id": "1923237790",
"message_count": 1,
"summary": "Complaint Date: 2017-4-22 Service Provider: Airtel Type of Complaint: Billing NCC need to do: Investigate and resolve the issue Complaint Details: Vb",
"type": "API",
"snoozed_until": null,
"last_message": "Complaint Date: 2017-4-22<br />\nService Provider: Airtel<br />\nType of Complaint: Billing<br />\nNCC need to do: Investigate and resolve the issue<br />\nComplaint Details: Vb",
"assignee": null,
"app_url": "https://matrixdroid.groovehq.com/groove_client/tickets/44746020",
"app_customer_url": "https://matrixdroid.groovehq.com/groove_client/contacts/customers/17295897",
"customer_name": "[email protected]",
"last_message_plain_text": "Complaint Date: 2017-4-22\nService Provider: Airtel\nType of Complaint: Billing\nNCC need to do: Investigate and resolve the issue\nComplaint Details: Vb"
}
、私は はどのように取得することができますlinks->customer->href
データを取得する必要がありますこの?
私はこの試みた: - txtファイルに記述されたばかり
$json_data = file_get_contents('php://input');
$json_decode_data = json_decode($json_data);
file_put_contents('test.txt', $json_decode_data['links']['customer']['href']);
は何も。どのようにしてhrefデータを解析できますか?
のような何かをする必要があり、あなたには '$のjson_decode_data'変数がありませんコード。 '$ data'変数があります。しかし、 '$ data'は' StdClass'のインスタンスですが、コード内で配列を使用しようとしています。 1)存在しない変数を使用する、2)存在しない変数を配列として使用しようとする2つの間違いがあります。 – Mjh