Php 用文件获取内容发布json

Php 用文件获取内容发布json,php,postman,file-get-contents,Php,Postman,File Get Contents,在尝试创建脚本之前,我首先尝试使用postman应用程序,一切都顺利进行,没有任何限制,但在使用我制作的脚本之后,结果与应用程序postman给出的结果不一样 这是邮递员应用程序的结果 这是邮递员输出的结果 然后,我尝试使用我创建的脚本,如下所示 <?php $postdata = http_build_query( array ( 'question' => 'this is questions', 'questionMedia' => '', 'choice

在尝试创建脚本之前,我首先尝试使用postman应用程序,一切都顺利进行,没有任何限制,但在使用我制作的脚本之后,结果与应用程序postman给出的结果不一样

这是邮递员应用程序的结果

这是邮递员输出的结果

然后,我尝试使用我创建的脚本,如下所示

<?php
$postdata = http_build_query(
array (
  'question' => 'this is questions',
  'questionMedia' => '',
  'choices' => 
  array (
    0 => 
    array (
      'text' => '123123123',
    ),
    1 => 
    array (
      'text' => 'qweqweqwe',
    ),
    2 => 
    array (
      'text' => 'asdasdasd',
    ),
    3 => 
    array (
      'text' => 'zxczxczxcxc',
    ),
  ),
  'allowMultiChoice' => false,
  'endDate' => NULL,
  'enableCaptcha' => false,
  'hideResults' => false,
  'restriction' => 'ip',
)
);

$opts = array('http' =>
    array(
        'method'  => 'POST',
        'content' => $postdata,
        'header'  => 'User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36\r\n'
    )   
);

$context  = stream_context_create($opts);
$result = file_get_contents('https://www.polltab.com/api/poll/create', false, $context);
echo $result;
?>

但是,从上面的脚本生成如下所示的输出

这是从脚本获得的输出结果

尝试将
http\u build\u query
更改为
json\u encode
无效:(