Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by SamohtVII · May 04, 2020 at 12:55 AM · php

POST variable not sending to website php file

So I am having a huge issue where my php files don't recieve my form fields from Unity all of a sudden. I get

<b>Notice</b>: Undefined variable: name in <b>/home/xxxxxxx/public_html/MyGame/Save.php</b> on line <b>38</b><br> <br>

The code looks like this...

WWWForm form = new WWWForm(); form.AddField("name", usersName); form.AddField("score", highScore); WWW www = new WWW("https://www.undivided.com/MyGame/Save.php", form); yield return www;

This worked 2 weeks ago but I think something changed on my web server to effect this. I need help debugging this as I can't pin point what went wrong. Can anyone suggest some debugging methods.

I have found this.

if($_SERVER['REQUEST_METHOD'] == "POST"){ echo "We are POSTing<br />"; }

which prints out.

I also printed out my $GLOBALS and it returned this... Sorry for the wall of text but I feel it might help...As you can see there are no post varibales.

Thanks

UploadAFile Log Null: We are posting<br>array(6) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(0) { } ["_FILES"]=> array(0) { } ["_SERVER"]=> array(50) { ["LSPHP_ENABLE_USER_INI"]=> string(2) "on" ["PATH"]=> string(28) "/usr/local/bin:/bin:/bin" ["TEMP"]=> string(4) "/tmp" ["TMP"]=> string(4) "/tmp" ["TMPDIR"]=> string(4) "/tmp" ["PWD"]=> string(1) "/" ["HTTP_ACCEPT"]=> string(3) "*/*" ["HTTP_ACCEPT_ENCODING"]=> string(8) "identity" ["CONTENT_TYPE"]=> string(33) "application/x-www-form-urlencoded" ["CONTENT_LENGTH"]=> string(1) "0" ["HTTP_HOST"]=> string(15) "undivided.com" ["HTTP_USER_AGENT"]=> string(65) "UnityPlayer/2018.2.15f1 (UnityWebRequest/1.0, libcurl/7.52.0-DEV)" ["HTTP_X_UNITY_VERSION"]=> string(11) "2018.2.15f1" ["HTTP_X_HTTPS"]=> string(1) "1" ["REDIRECT_UNIQUE_ID"]=> string(27) "Xq9g99BbsdgfdsdfsdfgFAAABVY" ["REDIRECT_SCRIPT_URL"]=> string(34) "/MyGame/Save.html" ["REDIRECT_SCRIPT_URI"]=> string(57) "https://undivided.com/MyGame/Save.html" ["REDIRECT_SERVER_ADMIN"]=> string(20) "security@mywebsite.com.au" ["REDIRECT_ps"]=> string(5) "https" ["REDIRECT_HTTPS"]=> string(2) "on" ["REDIRECT_SSL_TLS_SNI"]=> string(15) "undivided.com" ["REDIRECT_STATUS"]=> string(3) "200" ["UNIQUE_ID"]=> string(27) "Xq9g99BbmhfghfgsdfgdsZkTEFAAABVY" ["SCRIPT_URL"]=> string(34) "/MyGame/Save.html" ["SCRIPT_URI"]=> string(57) "https://undivided.com/MyGame/Save.html" ["SERVER_ADMIN"]=> string(25) "webmaster@undivided.com" ["ps"]=> string(5) "https" ["HTTPS"]=> string(2) "on" ["SSL_TLS_SNI"]=> string(15) "undivided.com" ["SERVER_SIGNATURE"]=> string(0) "" ["SERVER_SOFTWARE"]=> string(6) "Apache" ["SERVER_NAME"]=> string(15) "undivided.com" ["SERVER_ADDR"]=> string(14) "43.234.654.123" ["SERVER_PORT"]=> string(3) "443" ["REMOTE_ADDR"]=> string(13) "12.123.12.123" ["DOCUMENT_ROOT"]=> string(30) "/home/fdgdsfasdf/public_html" ["REQUEST_SCHEME"]=> string(5) "https" ["CONTEXT_PREFIX"]=> string(0) "" ["CONTEXT_DOCUMENT_ROOT"]=> string(30) "/home/fsddasfdsda/public_html" ["SCRIPT_FILENAME"]=> string(63) "/home/fdsfdsfdsdfs/public_html/MyGame/Save.php" ["REMOTE_PORT"]=> string(5) "58931" ["REDIRECT_URL"]=> string(34) "/MyGame/Save.html" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(4) "POST" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(34) "/MyGame/Save.html" ["SCRIPT_NAME"]=> string(33) "/MyGame/Save.php" ["PHP_SELF"]=> string(33) "/MyGame/Save.php" ["REQUEST_TIME_FLOAT"]=> float(1588551927.163) ["REQUEST_TIME"]=> int(1588551927) } ["GLOBALS"]=> array(6) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(0) { } ["_FILES"]=> array(0) { } ["_SERVER"]=> array(50) { ["LSPHP_ENABLE_USER_INI"]=> string(2) "on" ["PATH"]=> string(28) "/usr/local/bin:/bin:/bin" ["TEMP"]=> string(4) "/tmp" ["TMP"]=> string(4) "/tmp" ["TMPDIR"]=> string(4) "/tmp" ["PWD"]=> string(1) "/" ["HTTP_ACCEPT"]=> string(3) "*/*" ["HTTP_ACCEPT_ENCODING"]=> string(8) "identity" ["CONTENT_TYPE"]=> string(33) "application/x-www-form-urlencoded" ["CONTENT_LENGTH"]=> string(1) "0" ["HTTP_HOST"]=> string(15) "undivided.com" ["HTTP_USER_AGENT"]=> string(65) "UnityPlayer/2018.2.15f1 (UnityWebRequest/1.0, libcurl/7.52.0-DEV)" ["HTTP_X_UNITY_VERSION"]=> string(11) "2018.2.15f1" ["HTTP_X_HTTPS"]=> string(1) "1" ["REDIRECT_UNIQUE_ID"]=> string(27) "Xq9g9etrrettgfdgfvvvdskTEFAAABVY" ["REDIRECT_SCRIPT_URL"]=> string(34) "/MyGame/Save.html" ["REDIRECT_SCRIPT_URI"]=> string(57) "https://undivided.com/MyGame/Save.html" ["REDIRECT_SERVER_ADMIN"]=> string(20) "security@mywebsite.com.au" ["REDIRECT_ps"]=> string(5) "https" ["REDIRECT_HTTPS"]=> string(2) "on" ["REDIRECT_SSL_TLS_SNI"]=> string(15) "undivided.com" ["REDIRECT_STATUS"]=> string(3) "200" ["UNIQUE_ID"]=> string(27) "Xq9g99BbgfdfhdhgghffdkTEFAAABVY" ["SCRIPT_URL"]=> string(34) "/MyGame/Save.html" ["SCRIPT_URI"]=> string(57) "https://undivided.com/MyGame/Save.html" ["SERVER_ADMIN"]=> string(25) "webmaster@undivided.com" ["ps"]=> string(5) "https" ["HTTPS"]=> string(2) "on" ["SSL_TLS_SNI"]=> string(15) "undivided.com" ["SERVER_SIGNATURE"]=> string(0) "" ["SERVER_SOFTWARE"]=> string(6) "Apache" ["SERVER_NAME"]=> string(15) "undivided.com" ["SERVER_ADDR"]=> string(14) "12.123.123.123" ["SERVER_PORT"]=> string(3) "443" ["REMOTE_ADDR"]=> string(13) "12.123.12.123" ["DOCUMENT_ROOT"]=> string(30) "/home/fdsdffdgsdf/public_html" ["REQUEST_SCHEME"]=> string(5) "https" ["CONTEXT_PREFIX"]=> string(0) "" ["CONTEXT_DOCUMENT_ROOT"]=> string(30) "/home/vddgfdsfdsdfs/public_html" ["SCRIPT_FILENAME"]=> string(63) "/home/hgffdggffgd/public_html/MyGame/Save.php" ["REMOTE_PORT"]=> string(5) "58931" ["REDIRECT_URL"]=> string(34) "/MyGame/Save.html" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(4) "POST" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(34) "/MyGame/Save.html" ["SCRIPT_NAME"]=> string(33) "/MyGame/Save.php" ["PHP_SELF"]=> string(33) "/MyGame/Save.php" ["REQUEST_TIME_FLOAT"]=> float(1588551927.163) ["REQUEST_TIME"]=> int(1588551927) } ["GLOBALS"]=> *RECURSION* } } N not setS not set<br> <b>Notice</b>: Undefined variable: name in <b>/home/tidjbg2jr8pe/public_html/DownhillSlalom/SaveScorePOST.php</b> on line <b>38</b><br> <br> <b>Notice</b>: Undefined variable: score in <b>/home/tidjbg2jr8pe/public_html/DownhillSlalom/SaveScorePOST.php</b> on line <b>39</b><br> <br> failarray(2) { ["User"]=> NULL ["Score"]=> NULL }

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by SamohtVII · May 04, 2020 at 01:41 AM

Sorry I did forget to mention I used https://reqbin.com/ to send POST data and it returns fine so it seems to be something with Unity or something that my website doesn't like about Unity. I hoping you can help me debug the Unity side of it. It's a standard LAMP website with fresh SSL certs. No custom config stuff as I'm not experienced in that. I would think the wierdest things are it accepts it when I change the code to GET and also accepts from everywhere but Unity and my builds. I am using the Editor but building for Android. Let me know if that helps at all. Thanks

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SamohtVII · May 04, 2020 at 04:19 AM 0
Share

Fuck, something happened when I updated my SSl i think. $$anonymous$$y fix was changing https://www.undivided.com/$$anonymous$$yGame/Save.php to https://undivided.com/$$anonymous$$yGame/Save.html Thanks for the help though.

avatar image Bunny83 SamohtVII · May 04, 2020 at 08:54 AM 0
Share

Don't you have a wilecard certificate for your server? For example this is the certificate for unity.com. The important things are the list of SANs which for this certificate are

 unity.com
 *.unity.com

Unity answers however answers.unity.com has a seperate certificate since its domain name resolves to a different server

avatar image
0

Answer by Bunny83 · May 04, 2020 at 01:30 AM

Well, yes, I would also assume that's an issue on your server side. However we can't really help you here since we know absolutely nothing about your server. Do you host it yourself? Or is it a free hoster / paid hoster? Do you have direct access to the apache config / php config? You use https so the next question is, what certificate do you use? If you use a lets encrypt certificate, keep in mind that they expire after 3 month and have to be renewed.


Apart from all that what's your actual platform your testing your code on? Inside the editor? windows standalone? WebGL? Android? iOS? Can you temporarily switch to http if your server allows it? If you use http you can use Wireshark on windows to intercept and view the actual request. If you're building for WebGL you can use the developer tools of your browser (FireFox or chrome has them) to see the requests and all data that actually goes out.


You can try postman-echo.com and temporarily send your request to that site. It will return all the data the server has received in it's response as json.


Likewise there are other sites (like this one) which allows to make arbitrary post requests to a specified server. So you should be able to test both sides in isolation.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

125 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Best online servers for Web Browser Multiplayer? 2 Answers

Read second Line of WWWForm.data 1 Answer

Retrieve a value from a PHP file and print it on the Unity3D console. 1 Answer

unity + php get Authentication 0 Answers

Using https and SSL 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges