Now you want to simulate HTTP://CLI.IM/DEQR
Upload two-dimensional code recognition image, F12 observation
is to upload the picture post to Http://upload.api.cli.im/uplo ...,
Then return a picture address and post the image address to http://cli.in/apis/up/deqrimg
Then identify the QR code.
I use PHP's curl post to upload pictures, has always been shown null, I missed what parameters did not add?
public function index(){ $url='http://upload.api.cli.im/upload.php?kid=cliim'; $r_file='/test.jpg'; $res=$this->upload_file($url,$r_file); var_dump($res);} private function upload_file($url,$r_file) { $file = array("fax_file"=>'@'.$r_file,'type'=>'image/jpeg');//文件路径,前面要加@,表明是文件上传. $curl = curl_init(); curl_setopt($curl, CURLOPT_URL,$url); curl_setopt($curl,CURLOPT_POST,1); curl_setopt($curl,CURLOPT_POSTFIELDS,$file); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); $result = curl_exec($curl); //$result 获取页面信息 curl_close($curl); echo $result ; //输出 页面结果 }
The $res returned by the above code will always be null, and it should normally return a picture address belonging to the forage.
Reply content:
Now you want to simulate HTTP://CLI.IM/DEQR
Upload two-dimensional code recognition image, F12 observation
is to upload the picture post to Http://upload.api.cli.im/uplo ...,
Then return a picture address and post the image address to http://cli.in/apis/up/deqrimg
Then identify the QR code.
I use PHP's curl post to upload pictures, has always been shown null, I missed what parameters did not add?
public function index(){ $url='http://upload.api.cli.im/upload.php?kid=cliim'; $r_file='/test.jpg'; $res=$this->upload_file($url,$r_file); var_dump($res);} private function upload_file($url,$r_file) { $file = array("fax_file"=>'@'.$r_file,'type'=>'image/jpeg');//文件路径,前面要加@,表明是文件上传. $curl = curl_init(); curl_setopt($curl, CURLOPT_URL,$url); curl_setopt($curl,CURLOPT_POST,1); curl_setopt($curl,CURLOPT_POSTFIELDS,$file); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); $result = curl_exec($curl); //$result 获取页面信息 curl_close($curl); echo $result ; //输出 页面结果 }
The $res returned by the above code will always be null, and it should normally return a picture address belonging to the forage.