如何从PHP发送字节数组

我正在尝试将图像的字节数组发送到json对象中的Web服务.但是,该请求从未命中我的服务器.如果我只发送一个空数组,它将命中服务器并返回json响应.下面是我的代码.此代码有什么问题

<?PHP 


header('Content-type: application/json');
//Read an image from third party URL
$contents= file_get_contents('http://i2.cdn.turner.com/cnn/dam/assets/120612031415-granderson-speech-c1-main.jpg');
$byteArr = str_split($contents);
foreach ($byteArr as $val) 
{ 
 $points[] = ord($val); 
}
$output = join (" " , $points);
//echo($output);
//If i use "photo"=>[] in below array it works fine
$jsonArray = array("comments"=>"Hiee", "type"=>"test", "photo"=>[$output],"custid"=>"test@test.com");
$buzz = json_encode($jsonArray);
try {
//Webservice call to store the image in DB and send mail
$jsonResponse = @file_get_contents("http://localhost/example/json.htm?action=sendBuzzRequest&email=test@test.com&pass=test1234&buzz=".$buzz);
echo ($jsonResponse);
} catch(Exception $e)
{
 $e->getMessage();
}
?>

非常感激你的帮助.

解决方法:

如果解决了这个问题,我就不会支持,但该网址未进行编码.您可以先尝试一下.

$jsonResponse = @file_get_contents("http://localhost/example/json.htm?action=sendBuzzRequest&email=test%40test.com&pass=test1234&buzz=" . urlencode($buzz));

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...