试试下面的代码:
$username='ABC';$password='XYZ';$URL='<URL>';$ch = curl_init();curl_setopt($ch, CURLOPT_URL,$URL);curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 secondscurl_setopt($ch, CURLOPT_RETURNTRANSFER,1);curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");$result=curl_exec ($ch);$status_pre = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status precurl_close ($ch);



