|
按楼上所述,php改为- <?php
- $characters = 'abcdefghijklmnopqrstuvwxyz';
- $randomString = '';
- for ($i = 0; $i < 6; $i++) {
- $randomString .= $characters[rand(0, 25)];
- }
- $data = array(
- 'action'=>'image',
- 'token'=>$randomString,
- 'tex'=>$_GET["tex"],
- 'rerender'=>false
- );
- $ch = curl_init();
- curl_setopt_array($ch, array(
- CURLOPT_URL => "https://artofproblemsolving.com/m/texer/ajax.php",
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => 1,
- CURLOPT_SSL_VERIFYHOST => 0,
- CURLOPT_SSL_VERIFYPEER => 0,
- CURLOPT_HTTPHEADER => array('Content-Type: application/x-www-form-urlencoded'),
- CURLOPT_POSTFIELDS => http_build_query($data)
- ));
- $result=curl_exec($ch);
- if(curl_errno($ch)){
- die('Request Error:' . curl_error($ch));
- }
- $url=json_decode($result)->response->urls[0];
- $width=json_decode($result)->response->width[0];
- echo "<img src='$url' width='$width'>";
- ?>
复制代码 这样返回的是图片的HTML,指定了宽度。 |
|