|
@@ -119,17 +119,15 @@ class weixina {
|
|
|
"page"=>$page,
|
|
|
"scene"=>$scene,
|
|
|
"width"=>$width,
|
|
|
- "auto_color"=>true,
|
|
|
+
|
|
|
"is_hyaline" => false,
|
|
|
));
|
|
|
- $data = $this->Post($postData,$url);
|
|
|
+ $data = $this->Post($postData,$url,1);
|
|
|
$res = $data;
|
|
|
if(empty($data)){
|
|
|
return false;
|
|
|
}
|
|
|
- return $data;
|
|
|
- $data = json_decode($data,true);
|
|
|
- if(empty($data) || empty($data["contentType"]) || empty($data["buffer"]) || $data["errcode"]!=0){
|
|
|
+ if(empty($data) || empty($data["contentType"]) || empty($data["buffer"])){
|
|
|
$this->error="返回参数错误".$res;
|
|
|
return false;
|
|
|
}
|
|
@@ -286,25 +284,37 @@ class weixina {
|
|
|
* @param $url
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- function Post($curlPost, $url) {
|
|
|
+ function Post($curlPost, $url, $isres=0) {
|
|
|
$curl = curl_init();
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
curl_setopt($curl, CURLOPT_HEADER, false);
|
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
|
|
- curl_setopt($curl, CURLOPT_NOBODY, true);
|
|
|
+
|
|
|
curl_setopt($curl, CURLOPT_POST, true);
|
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
|
|
|
$return_str = curl_exec($curl);
|
|
|
- var_dump($return_str);
|
|
|
$err = "";
|
|
|
if(empty($return_str)){
|
|
|
$err = "系统错误:".curl_error($curl);
|
|
|
}
|
|
|
+
|
|
|
+ $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
|
|
+ $content_type = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
|
|
|
+
|
|
|
curl_close($curl);
|
|
|
if(!empty($err)){
|
|
|
$this->error = $err;
|
|
|
return false;
|
|
|
}
|
|
|
+ if($isres==1){
|
|
|
+ if($httpcode!=200){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return [
|
|
|
+ "contentType"=>$content_type,
|
|
|
+ "buffer"=>$return_str
|
|
|
+ ];
|
|
|
+ }
|
|
|
return $return_str;
|
|
|
}
|
|
|
|