Пример #1
0
                         }
                     }
                 }
             }
         }
         break;
     case $wechat::MSGTYPE_IMAGE:
         $info = getimagesize($postArr['PicUrl']);
         $extension = image_type_to_extension($info[2]);
         $filename = "{$postArr['MsgId']}{$extension}";
         file_put_contents('../upload/image/' . $filename, fopen($postArr['PicUrl'], 'r'));
         $content = $filename;
         break;
     case $wechat::MSGTYPE_VIDEO:
     case $wechat::MSGTYPE_VOICE:
         $return = $wechat->getTempMedia($request_type, $postArr['MediaId']);
         $content = $return['filename'];
         break;
     case $wechat::MSGTYPE_LOCATION:
         $content = $postArr['Label'];
         break;
 }
 $data = array('userID' => $postArr['FromUserName'], 'media_type' => $request_type, 'request' => 1, 'content' => $content, 'MsgId' => isset($postArr['MsgId']) ? $postArr['MsgId'] : null, 'raw' => json_encode($postArr));
 log_transaction($data);
 /* ------------------- request end ------------------------- */
 /** ------------------ response ------------------- **/
 switch ($postArr['MsgType']) {
     case $wechat::MSGTYPE_TEXT:
         include_once '../snippet/keyword_reply.php';
         break;
         /**