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

206
Visualizações
Unity - WWWForm not posting variables

I have this working just fine in one project however in a second project my _POST variables are blank. Thoughts?

IEnumerator GetClub()
     {
         Debug.Log("GetClub: - START");
         WWWForm form = new WWWForm();
         form.AddField("state", "TX");
         form.AddField("author", "MYNAME");
 
         UnityWebRequest res = UnityWebRequest.Post(getGlubsURL, form);
 
         yield return res.SendWebRequest();
 
         Debug.Log(res.downloadHandler.text);

and the php file is a simple

<?php
 echo "MADE IT  ";
 echo "author: [" . $_POST['author'] . "] ";
 echo "state: [" . $_POST['state'] . "]";
 ?>

and console in unity is:

MADE IT author: [] state: [] UnityEngine.Debug:Log (object)

This works fine in POSTMAN so not sure why Unity Forms are not passing POST variables?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I've been through a similar problem; $_POST is empty in general.

Then I found out that the URL was "HTTP://website.com/folder", not "HTTP://website.com/folder/". That last "/" is important apparently because without it, you'd get a "PAGE MOVED PERMANENTLY" error then redirect you to "HTTP://website.com/folder/index.php" discarding previous POST request.

over 4 years ago · Santiago Trujillo 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