Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.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_Curl_Post - Fatal编程技术网

通过php发布Curl请求

通过php发布Curl请求,php,curl,post,Php,Curl,Post,我想向pilosa数据库发送一个post请求。请求是这样的- curl localhost:10101/index/user/query -X柱 -d“位图(frame=“language”,id=5)” 如何通过php发送以下请求 参考链接:如果您没有可用的库,可以使用php的文件\u get\u contents查询Pilosa,该文件是核心php的一部分。以下php脚本应执行示例查询: <?php $url = 'http://localhost:10101/index/user/

我想向pilosa数据库发送一个post请求。请求是这样的-

curl localhost:10101/index/user/query -X柱 -d“位图(frame=“language”,id=5)”

如何通过php发送以下请求

参考链接:

如果您没有可用的库,可以使用php的
文件\u get\u contents
查询Pilosa,该文件是核心php的一部分。以下php脚本应执行示例查询:

<?php

$url = 'http://localhost:10101/index/user/query';
$data = 'Bitmap(frame="language", id=5)';

$options = array(
    'http' => array(
        'method'  => 'POST',
        'content' => $data
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

var_dump($result);

?>

“如何通过php发送以下请求?”-阅读cURL命令行文档,了解参数的含义。然后阅读PHP cURL文档,找出相应的选项/调用。对于接下来的问题,请转到并阅读,然后,如果您确定您的问题符合SO规则,请阅读,以便能够提出一个好的、格式良好的主题问题。