$data = zhangzhen((int) $matches[1]); } else { $data = zhangzhen(rand(0, 49)); } } } } elseif ($type == 'image') { $picurl = $xml->PicUrl; $img_data = $f->fetch($picurl); if ($f->errno() == 0) { $img_name = $openid . date(YmdHis) . '.jpg'; $s->write('wephoto', $img_name, $img_data); $picUrl = $s->getUrl('wephoto', $img_name); $mysql->runSql("UPDATE moments SET photo='{$picUrl}' WHERE FromUserName='******'"); $data = '你的图片已上传成功!'; $data .= "\n" . picRec($picurl); } else { $data = 'failed'; } } elseif ($type == 'voice') { $data = '小u听不懂人话的说。。'; } elseif ($type == 'event') { $event = strtolower($xml->Event); if ($event == 'subscribe') { $data = $xiaoU; } } $mysql->closeDb(); //贱鸡自动回复 if ($data) { if (is_array($data)) {
<?php header("content-Type: text/html; charset=utf-8"); function picRec($url) { $picRec_api_url = 'http://api2.sinaapp.com/recognize/picture/?appkey=2989441965&appsecert=4e5e32eb22617e691165e16d6a152a18&reqtype=text&keyword=' . $url; $result = file_get_contents($picRec_api_url); $pic = json_decode($result); return $pic->text->content; } echo picRec('http://img.hb.aicdn.com/1fbb370153a4948d922d206c2acd608e7ea42b0c2fb27-8lGtP5_fw580');