如何从8080端口在php中获取json数据

时间:2018-08-27 07:54:09

标签: json curl

我在php中使用CURL函数。 我从8080端口获取json数据,但仅返回空值。 如何从8080端口获取json数据 链接下方的CURL函数中正在使用...

<?php 

$url = 'https://example.com:8080/getdata/?format=json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headr);  
curl_setopt($ch, CURLOPT_PORT, 8080);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
echo $result;

?>

0 个答案:

没有答案