Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

245
Visualizações
How to Simulate Click Redrect Like Human

I'm working on a project and I'm blocked by lack of knowledge. The code works but I don't know if the website 3 sees it as if it was clicked by a human.

Let me explain: I have 3 websites in total.

  • Website 1 redirect to Website 2 when clicking on a button.

  • Website 2 check if the referrer comes from Website 1 and automatically redirect to Website 3.

I need the redirect (Website 2 -> Website 3) to look as if the button was clicked by a human and not to show that I have redirected it automatically.

Code so far:

if (isset($_SERVER['HTTP_REFERER'])) {
    $url_info = parse_url($_SERVER['HTTP_REFERER']);
    $countCharacter = substr_count($url_info['host'], '.');
    if($countCharacter == 2){
        $eldominio = explode(".", $url_info['host']);
        $elhost = $eldominio[1];
    }else if($countCharacter == 1){
        $eldominio = explode(".", $url_info['host']);
        $elhost = $eldominio[0];
    }

    //if referrer contain $elhost
    if($elhost == 'website1' || $elhost == 'website2'){
        $tieneHostaff = "yes";
    }else{//no host}

} else {  // referrer does not exist 

session_start();
if($tieneHostaff=="yes" && isset($_GET['q']) && !empty($_GET['q'])){
    //Create sessions and delete actual referrer
    $_SESSION['nombre'] = "y";
    $_SESSION['producto'] = $_GET['q'];
    echo "<script>window.location.reload(true);</script>";
    exit();
}

if($_SESSION['nombre'] == "y"){
// Destroy session and redirect to website 3
    session_unset();
    echo "<script>window.location.href = 'https://website3.com/".$_SESSION['producto']."'</script>";
    exit();
}

I need the last part to make the redirect (website 2 -> website 3) as if it was clicked by a human.

In the code below I'm getting it but I don't know if it's the best way or if it's right:

if($_SESSION['nombre'] == "y"){
// Destroy session and redirect to website 3
    session_unset();
    echo "<script>window.location.href = 'https://website3.com/".$_SESSION['producto']."'</script>";
    exit();
}

Website 3 checks referrer and all things to find that it's a human click

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Theoretically you could issue the click event on the element that handles it, but that's probably as close as you can get without using any sort of external automated testing tool which would do the clicking. PHP is executed on the server side, while JavaScript is executed on the client's side, so it would actually seem like the client's browser did the trigger rather than the application doing it.

<script>
    let elementYouWantToClick = document.getElementById('whatever-the-id-is');
    elementYouWantToClick.click();
</script>
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda