如何解决cUrl URL mantis 插入表
我使用 curl 在 mantis 上创建了一个 URL,我希望它在执行时填满我的 DATA 中的“holliday”表,我为 holliday 使用 API。
我用我的网址创建了我的函数,但我被阻止进一步
函数网址
function get_url_holliday( $t_date,$t_label,$timeout = 30 ) {
$url = str_replace( "&","&",urldecode(trim($url)) );
$ch = curl_init();
curl_setopt( $ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
curl_setopt( $ch,CURLOPT_URL,"https://calendrier.api.gouv.fr/jours-feries/metropole/2021.json" );
curl_setopt( $ch,CURLOPT_FOLLOWLOCATION,true );
curl_setopt( $ch,CURLOPT_ENCODING,"UTF-8" );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER,CURLOPT_AUTOREFERER,CURLOPT_SSL_VERIFYPEER,false ); # required for https urls
curl_setopt( $ch,CURLOPT_CONNECTTIMEOUT,$timeout );
curl_setopt( $ch,CURLOPT_TIMEOUT,CURLOPT_MAXREDirs,10 );
$content = curl_exec( $ch );
$response = curl_getinfo( $ch );
curl_close ( $ch );
var_dump($content);
die();
if ($response['http_code'] == 301 || $response['http_code'] == 302)
{
ini_set("user_agent","Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1");
if ( $headers = get_headers($response['url']) ) {
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
}
}
if (( preg_match("/>[[:space:]]+window\.location\.replace\('(.*)'\)/i",$content,$value) || preg_match("/>[[:space:]]+window\.location\=\"(.*)\"/i",$value) ) && $javascript_loop < 5){
return get_url( $value[1],$javascript_loop+1 );
} else {
return array( $content,$response );
}
$request_type_table = plugin_table('data','AbChiffrage');
$t_query = 'INSERT INTO '.$t_table .' (date,label) VALUES ('.db_param().','.db_param().')';
db_query($t_query,array($t_date,$t_label));
}
我的桌子
array( 'CreateTablesql',array( plugin_table( 'hollidays'),"
date C(255) DEFAULT NULL,label C(255) DEFAULT NULL
")
),
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。