最近在开发速卖通上传图片的功能,速卖通的api文档
文档上还有实例,以下是实例的代码
<?php
    //读取文件
    $filePath="C:/123.jpg";
    $fh = fopen($filePath, "rb");
    $data = fread($fh, filesize($filePath));
    fclose($fh);
    $appKey = '132345213';
    $appSecret ='kG=43214321jds';
    $accessToken = '53494330-4033-4aa4-adeb-b7fd7bb54807';    
    $fileName = '123.jpg';//post地址
$upload_image_server = 'http://gw.api.alibaba.com/fileapi/param2/1/aliexpress.open/api.uploadImage/'.$appKey.'?access_token='.$accessToken.'&fileName='.$fileName;//post提交
echo request_post($upload_image_server,$data);// post数据到url的函数
function request_post($remote_server,$content){
   $http_entity_type = 'application/x-www-from-urlencoded'; //发送的格式
    $context = array(
        'http'=>array(
            'method'=>'POST',
         // 这里可以增加其他header..
            'header'=>"Content-type: " .$http_entity_type ."\r\n".
                      'Content-length: '.strlen($content),
            'content'=>$content)
         );
    $stream_context = stream_context_create($context);
    $data = file_get_contents($remote_server,FALSE,$stream_context);
     return $data;
}
?>但我就出现问题
Warning: file_get_contents(http://gw.api.alibaba.com/fileapi/param2/1/aliexpress.open/api.uploadImage/132345213?access_token=fe02dfd8-d3344-49c1-a123-951dbdd5c7cc&amp;fileName=123.jpg): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in D:\wamp\www\express\demo.php on line 38请有这方面的大神帮小弟看看是什么问题?