User:SQL/getVio
Appearance
< User:SQL
function getVio( $page ) {
$options = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"User-Agent: SQLBot\r\n"
)
);
$context = stream_context_create($options);
$page = urlencode("Draft:" . $page);
$apiresult = json_decode( file_get_contents( "https://tools.wmflabs.org/copyvios/api.json?version=1&action=search&project=wikipedia&lang=en&use_engine=false&title=$page", false, $context ), TRUE );
return( round( $apiresult['best']['confidence'] * 100, 2 ) );
}