Simulation of forage upload QR code image, to obtain recognition results

Source: Internet
Author: User

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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.