Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Manveru · May 11, 2015 at 12:24 PM · c#wwwphpwwwformpost

PHP POST through $_REQUEST with WEBBUILD

Hi, i have app, that using php to store and use data from MySQL. All working fine in PC build and in editor play mode. But when i'm using Webbuild - application give nosing to PHP script. That is seem like webbuild can't give POST data, or i do something wrong. Anyway, there's C#:

  public IEnumerator SendDataToWeb(string answer, string id){
               if (coroutineInProcess == false){
                  coroutineInProcess = true;
                  WWWForm form = new WWWForm();
                  form.AddField( "UserID", id);
                  form.AddField( "Answer", answer );
          
          //wwwSendData get his value in diferent part of code
                  WWW download = new WWW( wwwSendData, form );
                  yield return download;        
                  if(!string.IsNullOrEmpty(download.error))
  {
                      Debug.Log ( "Error downloading: " + download.error );
                  } else {
                      Debug.Log ( download.text );
                  }
                  coroutineInProcess = false;
               }
              }

And there's php:

 <?php
 $userID = $_REQUEST['UserID'];
 $answer = $_REQUEST['Answer'];
 
 
 $host = 'localhost'; 
 $user = 'testUser'; 
 $password = '123qweasd'; 
 $db = 'testdb'; 
 $table = 'highscores'; 
 
 mysql_connect($host, $user, $password) or die(mysql_error()); 
 mysql_select_db($db); 
 
 $password = md5($password); 
 
 
 mysql_query("DELETE FROM `answers` WHERE  TO_DAYS(NOW())- TO_DAYS(dateValue) = 0 AND ID = '{$userID}' ") or die (mysql_error());
 
 
 mysql_query("INSERT INTO `answers` (ID, answer) VALUES ('{$userID}', '{$answer}')") or die (mysql_error());
 
 echo "Done";
 
 ?>

 

I adeed crossdomain.xml in root of my site. I Test all this stuff on denwer. Repeat: all working, exept post data from web build. In PC build and editor play mode all work without problems.

Sorry for bad knowlege of English.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Manveru · May 13, 2015 at 09:25 AM

For now, im using handmaded strings. I add strings to URL like this:

 public IEnumerator SendDataToWeb(string answer, string id){
          if (coroutineInProcess == false){
             coroutineInProcess = true;
             Debug.Log (answer);
             string getRequest1 = "UserID="+id; 
             string getRequest2 = "&Answer="+answer;     
             WWW download = new WWW( wwwSendData+"?"+getRequest1+getRequest2);
             yield return download;
             
             
             if(!string.IsNullOrEmpty(download.error)) {
                 Debug.Log ( "Error downloading: " + download.error );
             } else {
                 Debug.Log ( download.text );
             }
             coroutineInProcess = false;
          }
         }
 




I's working, but I'm not shure that this is safe and right...

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

2 People are following this question.

avatar image avatar image

Related Questions

WWWForm always returning Internal Server Error 1 Answer

Sending variables to HTML 1 Answer

Problem using WWW with PHP and MYSQL 3 Answers

How to Upload multiple files to a server using UnityWebRequest.Post(); 3 Answers

Why isn't this $_POST working properly? 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