/** * POST请求-简单数据 * @param $url * @param $data * @return mixed */ private function _requestPost($url,$data){ $headerArray =array("Content-type:application/json;charset='utf-8'","Accept:application/json"); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($curl); curl_close($curl); return json_decode($output,true); }
小程序创建直播 parameter startTime or endTime is invalid?时间戳没问题但一直提示参数错误? URL: "https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token="+accessToken; JSON: { "name": "测试", "coverImg": "NeUgZKL1Q1VQ_vKewVyUjteHNa-tRBcVGBU5IRCwd2dBkpXBmGtaltwVILvWfC5O", "startTime": 1592534352, "endTime": 1592537952, "anchorName": "老八", "anchorWechat": "ddssaa135", "shareImg": "4WsC6BwTu2p9RG8Q6WH0kQufJm4wbZA8dpPGrsop7h0KW3npLRPqnR2Zj0HOUJj4", "type": 0, "screenType": 0, "closeLike": 0, "closeGoods": 0, "closeComment": 0 } 请求头: post.addHeader("Accept", "application/json"); post.addHeader("Content-Type", "'application/json';charset='utf-8'"); post.addHeader("Cache-Control", "no-cache"); post.addHeader("Pragma", "no-cache");
2020-12-08/** * POST请求-简单数据 * @param $url * @param $data * @return mixed */ private function _requestPost($url,$data){ $headerArray =array("Content-type:application/json;charset='utf-8'","Accept:application/json"); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($curl); curl_close($curl); return json_decode($output,true); }
创建直播间接口 parameter startTime or endTime is invalid?{"name":"\u6d4b\u8bd5","coverImg":"SJCU8OIK-mqIhiudS_seUd70NbsKNARb8Z9oBayikkivT0VrNTRh_o5NRSBw_gXc","startTime":1590567733,"endTime":1590582133,"anchorName":"\u5764\u54e5","anchorWechat":"ylxw1234","anchorImg":"xjegOQF831gt-iatd3K5UJB3VgGcIVe8GlzFdyQ_MZWBB4fDnBZk_axh7t51JNnk","type":0,"screenType":0,"closeLike":0,"closeGoods":0,"closeComment":0}
2020-12-08/** * POST请求-文件 * @param $url * @param $params * @return bool|string */ private function _ajaxPostImage( $url, $params ) { $curl = curl_init(); curl_setopt( $curl, CURLOPT_URL, $url ); //URL curl_setopt( $curl, CURLOPT_HTTPHEADER, ['Content-Type'=>'application/json']); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $curl, CURLOPT_POST, 1 ); curl_setopt( $curl, CURLOPT_POSTFIELDS, $params); curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, FALSE ); curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, FALSE ); $response = curl_exec( $curl ); curl_close( $curl ); return $response; }
media data missing hint[图片]
2020-12-08