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 Apr 12, 2019 at 08:03 PM by unknownuser for the following reason:

Other

avatar image
0
Question by unknownuser · Jun 19, 2013 at 06:57 AM · wwwloginwebrequestphp

Why do I get a newline (\n br) while sending a simple string from php to Unity c#

Hi everyone,I'm trying to understand how I can interract between Unity and PHP so I started with simple stuff but it's been 3 days that I'm fighting with this and can't find a solution, I have this simple code:

 string url = "http://localhost/login.php";
 
 IEnumerator PhpRequest()
     {
         WWW webRequest2 = new WWW(url);
         yield return webRequest2;
         print(webRequest2.text);
     }

and GUI button that calls the couroutine on click...

Then I have the "login.php" file with a simple echo instruction:

 <?php  echo'a';?>

When I test it I get in Unity console a free line then a, I know this because I tried to execute something if(webRequest2.text == "a") and it didnt work, then I tried print("x"+webRequest2.text) and I got :

x

a

Thanks for reading, and I'm hopelessly waiting for an answer and hoping to finally move on to interesting stuff :'(

Comment
Add comment · Show 1
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 Adamcbrz · Jun 19, 2013 at 05:50 PM 0
Share

have you tried setting php content-type so it treats it as text?

1 Reply

  • Sort: 
avatar image
1

Answer by Adamcbrz · Jun 19, 2013 at 06:01 PM

I tested what your issue and i can't reproduce it. With what you have said I would assume that one of two things are going on.

1) In your php file you have extra line breaks at the beginning of the file. 2) Your web-server is is treating it as html or some other content type that would cause the line break. It could also be something configured with your web-server.

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

Necessary Data Rewind Wasn't Possible WWWForm Error 0 Answers

WWW (webrequest)not working in windows8.1 app store build 0 Answers

Download multiple files from server 2 Answers

How Do i check for Duplicate username in database 4 Answers

sending values to server script 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