0

before trying to create the script, I tried first using the postman application, and all went smoothly without any constraint, but after I use the script I have made, the result is not the same as given by the application postman.

this is the result of the postman app this is the result of the postman app

and this is the result of the output obtained from the postman and this is the result of the output obtained from the postman

and then, I try to use the script I have created, as below

<?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;
?>

but, from the script above, produces the output as shown below.

This Is the result of the output obtained from the script This Is the result of the output obtained from the script

Nic3500
  • 8,144
  • 10
  • 29
  • 40
Ronald J
  • 1
  • 3

0 Answers0