Hi!, I’m trying to update a pass through template name, but I’m reciving a null body… this is with UNIREST for PHP…
with UNIREST with NODE.JS works like a charm… but PHP?
<?php
require(dirname(FILE) . ‘/lib/Unirest.php’);
$key = ‘j6WhcWg1sRkXfpz7wBtdQxFdtAW7jSb9’;
$response1 = Unirest::get(
“https://passkit-passkit.p.mashape.com/authenticate”,
array(
“X-Mashape-Authorization” => $key
),
null
);
$response = Unirest::put(
“https://passkit-passkit.p.mashape.com/pass/issue/template/POC Passkit”,
array(
“X-Mashape-Authorization” => $key,
“Content-Type” => “application/json”
),
json_encode(array(‘data1’ => 1))
);
var_dump($response->body);
?>
RESPONSE:
object(Unirest\HttpResponse)[3]
private ‘code’ => int 400
private ‘raw_body’ => boolean false
private ‘body’ => null <<<<<------------------------------------
private ‘headers’ =>
array (size=2)
‘Content-Length’ => string ‘0’ (length=1)
‘Connection’ => string ‘Close’ (length=5)
THANKS SO MUCH
Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:
The issue has to do with the way PHP and curl encapsulate the URL.
Your template name has a space in it. Try replacing the space with %20 and you should find it works.
Wow, so easy…
Thanks so much guys!!!