Trying to post to a url, and recieve an image.
for example (this works in the browser):
my code:
$url = 'https://providers.cloudsoftphone.com/lib/prettyqr/createQR.php';
$fields = array(
  'user'=> 123,
  'pass'=> 321,
  'cloudid'=> 'test',
  'format'=> 'png'
);
$options = array(
    'http' => array(
    'header'  => 'Content-type: application/x-www-form-urlencoded',
    'method'  => 'POST',
    'content' => http_build_query($fields)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
tried following this answer.
returns "invalid input"
**EDIT**
also trying with curl:
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec( $ch );
var_dump($response);
same result ('invalid input')
 
     
     
    