Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php-解码http响应_Php_Json_Http_Decode - Fatal编程技术网

Php-解码http响应

Php-解码http响应,php,json,http,decode,Php,Json,Http,Decode,我需要将请求的响应解码为数组 $result = $this->sendHttpRequestFromHook($hook, $item); $customer = $result['response']; $customerDec = json_decode($customer, true); $result包含一个success、response和status数组,我将响应分隔为$customer HTTP/1.

我需要将请求的响应解码为数组

            $result = $this->sendHttpRequestFromHook($hook, $item);
            $customer = $result['response'];
            $customerDec = json_decode($customer, true);
$result包含一个success、response和status数组,我将响应分隔为$customer

HTTP/1.1 201 Created
Date: Wed, 11 Nov 2020 13:01:45 GMT
Content-Type: application/json
Content-Length: 656
Connection: keep-alive
Set-Cookie: __cfduid=d0b3005ad0a12f77a2c90d415299a67b81605099705; expires=Fri, 11-Dec-20 13:01:45 GMT; path=/; domain=.waveapps.com; HttpOnly; SameSite=Lax; Secure
Set-Cookie: AWSALB=UN0XCFMkT2N0J9s1zV8rT7DnX2602qwovF7WuI8dfGw7hQdd/m0sTpQKnj2LDQZHEt04qfdWCE4IdzHVUbf+3sYGPXAIXtXLlOYv3rfMyz+m0pdgp4ydwoCGztrR; Expires=Wed, 18 Nov 2020 13:01:45 GMT; Path=/
Set-Cookie: AWSALBCORS=UN0XCFMkT2N0J9s1zV8rT7DnX2602qwovF7WuI8dfGw7hQdd/m0sTpQKnj2LDQZHEt04qfdWCE4IdzHVUbf+3sYGPXAIXtXLlOYv3rfMyz+m0pdgp4ydwoCGztrR; Expires=Wed, 18 Nov 2020 13:01:45 GMT; Path=/; SameSite=None; Secure
Allow: GET, POST, HEAD, OPTIONS
X-Client-Id: zUUT6X7oVQ.fV_DR.65QGl9X8aZluRjJVI1G-v-6
X-Wave-API-Version: 1
Vary: Origin, Cookie
Expires: Wed, 11 Nov 2020 13:01:44 GMT
Cache-Control: no-cache
Pragma: no-cache
CF-Cache-Status: DYNAMIC
cf-request-id: 0658feeaea00007f1181a8b000000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Strict-Transport-Security: max-age=7776000; includeSubDomains
X-Content-Type-Options: nosniff
Server: cloudflare
CF-RAY: 5f083424adcb7f11-CMB

{"id":46437620,"url":"https://api.waveapps.com/businesses/customers/46437620/","account_number":"","active":true,"name":"ddddd xxxxx","first_name":"","last_name":"","email":"ttttt@t.lk","fax_number":"","mobile_number":"","phone_number":"","toll_free_number":"","website":"","internal_notes":"","currency":{"url":"https://api.waveapps.com/currencies/SGD/","code":"SGD","symbol":"$","name":"Singapore dollar","plural":null},"address1":"","address2":"","city":"","province":null,"country":null,"postal_code":"","date_created":"2020-11-11T13:01:45+00:00","date_modified":"2020-11-11T13:01:45+00:00","shipping_details":null}
我需要获得上述结果的id。请帮助

在我的终端中获得以下var_dump($customer)的结果


那么到底是什么问题呢?你有回应,你已经解码了。尝试获取id但失败的代码在哪里?$customerDec获取结果为nullWait,当您说“客户的结果如下”时,这是
$customer
变量的实际转储吗?是的,这是我为$result获得的http响应,我将其分离为$customer。您从何处获得所有这些信息?开发者工具栏或从实际的
var\u dump
调用?
string(1910) "HTTP/1.1 201 Created
Date: Wed, 11 Nov 2020 15:12:23 GMT
Content-Type: application/json
Content-Length: 659
Connection: keep-alive
Set-Cookie: __cfduid=d4340d399a0ff44e41c51062a9baca52f1605107542; expires=Fri, 11-Dec-20 15:12:22 GMT; path=/; domain=.waveapps.com; HttpOnly; SameSite=Lax; Secure
Set-Cookie: AWSALB=4BtBF6k5ldc1RuDHRZP1CXNqi4dGJk2pyO5LLeZSwiLU12A0k9Ah71KZtGSCjgQpQmhVAbPPuYbxt72kgOJ8+Jt5asPIYBziSz+ru8yKxz8fO73rVpcwzVNerxoh; Expires=Wed, 18 Nov 2020 15:12:22 GMT; Path=/
Set-Cookie: AWSALBC"...