¿Cómo falsificar la UA del navegador usando php?
El método para falsificar file_get_contents user_agent es el siguiente:
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)').Windows NT 5.1; SV1; .NET CLR 2.0.50727;)');
método curl para falsificar user_agent:
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible. MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727;)');
El siguiente es el método de función completo de curl:
función curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt( $c, CURLOPT_HEADER, 1); //información del encabezado de salida para el servidor remoto
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0 .50727;)' );
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c); $c);
si ($contenido) {return$contenido;}.
else {return FALSE;}
}
Esto está listo para ser eliminado y user_agent es algo que puedes cambiar tú mismo.