<?php /** * 验证码接口示例 * 请在本文件所在目录里放置一张图片文件:1.png * 可在 http://op.juhe.cn/vercode/demo/assets/images/1.png下载本示例中使用的图片文件 * * !!!以下代码仅供参考,具体调试、调优等步骤需要您自己动手!!! */ header("Content-type:text/html;charset=utf-8"); /* 请自行学习curl的知识,以下代码仅作引导之用,不可用于生产环境 */ $ch = curl_init('http://op.juhe.cn/vercode/index'); $cfile = curl_file_create('1.png', 'image/png', 'pic.png'); $data = array( 'key' => '9427ecb33008f9c40857229912345678', //请替换成您自己的key 'codeType' => '6001', // 验证码类型代码,请在https://www.juhe.cn/docs/api/id/60/aid/352查询 'image' => $cfile, ); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = curl_exec($ch); curl_close($ch); var_dump($response);