| #395 | curl_setopt($ch, CURLOPT_PROXY, $proxyIp); // 设置代理IP |
| #396 | curl_setopt($ch, CURLOPT_PROXYPORT, (int) $proxyPort); // 设置代理端口,并确保端口是整数类型 |
| #397 | // 确保getRandUA函数存在并且返回有效的用户代理 |
| #398 | if (function_exists('getRandUA')) { |
| #399 | curl_setopt($ch, CURLOPT_USERAGENT, getRandUA()); |
| #400 | } else { |
| #401 | // 错误处理,如果getRandUA函数不存在 |
| #402 | error_log('Function getRandUA does not exist.'); |
| #403 | return false; |
| #404 | } |