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 /
This question was closed May 18, 2013 at 12:14 PM by Fattie for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by biohazard2u · Apr 26, 2013 at 05:46 PM · c#wwwphp

www.text + php + c# issue

I’m testing the WWW class functionality but I’m having problems to retrieve the data from the server. Since posting data is ok, I'll skip that bit.

On the server side, unityOut.php

 <?php
    
     $sql = "SELECT * FROM unity ORDER BY cod_user DESC";        
     $consulta = mysql_query($sql, $conexion);
 
     while($reg = mysql_fetch_array($consulta)){         

         echo $reg["name"];    
         echo $reg["extra_field"];    
     }

?>

That code connects with DB ok, since I can look for the website and see it on the browser:

Now, on the Unity C# side, I want to retrieve that data:

     public string url = "http://...url.../unityOut.php";      
     private WWW www;        

     void OnGUI ( ) {
         
         if (GUI.Button(new Rect(8*unitW, 5*unitH, 8*unitW, 2*unitH), "Get data")){            
             StartCoroutine("getData");
         }                        
     }     

      IEnumerator getData(){
         
         www = new WWW(url);
         yield return www;
         Debug.Log("hello: " + www.text);
         }
     }
 }


I'm ok with parsing whatever it comes, but, at this moment... All I get for www.text is the html label. Any clues of what am I missing?

Thanks

Comment
Add comment · Show 3
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 Fattie · Apr 26, 2013 at 05:47 PM 0
Share

note, it is incredibly unlikely anyone will answer a question with so much long code

also this is really just a php setver question. consider stackoverflow? the weenies on that site will give you many long answers immediately :)

avatar image biohazard2u · Apr 26, 2013 at 06:12 PM 0
Share

I removed unnecessary code.

avatar image jaybennett · May 18, 2013 at 10:18 AM 0
Share

I have this same problem, even copying directly over from a working JS code. It must be something in C# that needs to be different because none of these answers on Unity Answers work for me!

2 Replies

  • Sort: 
avatar image
0

Answer by jaybennett · May 18, 2013 at 10:18 AM

I have this same problem, even copying directly over from a working JS code. It must be something in C# that needs to be different because none of these answers on Unity Answers work for me!

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
avatar image
0

Answer by biohazard2u · May 18, 2013 at 10:35 AM

My problem, in the end, had nothing to do with coding; all it was is that I was forgetting to refresh a URL so I was always running the old code. My advice, make sure you have updated all your php files on the server. Also, if you have a public URL string storing the URL to collect/send data, make sure that any changes on the code are happening on the Inspector too.

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

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Download multiple files from server 2 Answers

Sending variables to HTML 1 Answer

PHP POST through $_REQUEST with WEBBUILD 1 Answer

Is it possible to call a Javascript code on local server from Unity? (Google Chart API involved) 2 Answers

www php doesnt receive whole string 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