Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.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 cURL响应,如何处理和选择数据?_Php_Codeigniter_Curl - Fatal编程技术网

返回字符串的PHP cURL响应,如何处理和选择数据?

返回字符串的PHP cURL响应,如何处理和选择数据?,php,codeigniter,curl,Php,Codeigniter,Curl,我使用Codeigniter curl库对url执行一个简单的get请求。当我回显响应时,它会以字符串的形式返回。我不太清楚如何将该字符串转换为可用格式,因为我需要在函数中从returntoprogress的特定部分进行选择 我的代码是通过Codeigniter运行的,使用Philsturgeon的curl库,下面是我使用的一个简单示例: $this->load->library('Curl'); $response = $this->curl->simple_get(

我使用Codeigniter curl库对url执行一个简单的get请求。当我回显响应时,它会以字符串的形式返回。我不太清楚如何将该字符串转换为可用格式,因为我需要在函数中从returntoprogress的特定部分进行选择

我的代码是通过Codeigniter运行的,使用Philsturgeon的curl库,下面是我使用的一个简单示例:

$this->load->library('Curl');

$response = $this->curl->simple_get('https://api.twitch.tv/kraken/channels/username');

var_dump($response);

我觉得我错过了一些简单的东西。有什么帮助吗?

你能发布响应吗?如果我错了,请纠正我,但我认为响应不会有多大帮助,因为它太大了,但它只是一个curl响应的字符串格式版本。好的,看起来响应是JSON格式的,所以请尝试JSON_decode,它将返回一个包含定义和标识的各种数据元素的数组,我知道我试过了,但没有成功。谢谢,我又试了一次,现在功能正常了。谢谢