-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerScript.cs
More file actions
52 lines (43 loc) · 1.48 KB
/
ServerScript.cs
File metadata and controls
52 lines (43 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System.Collections;
using UnityEngine;
public class ServerScript : MonoBehaviour
{
//[SerializeField]
//private string AccessKeyID = "AKIARMYOCDO3STQI2Q42";
//[SerializeField]
//private string AccessKey = "kp9szSqJ9sq2AayhMXyXkY+pOHPtw+JootJ1YA0Q";
public string SendMgs;
public string ReadMsg;
//string setURL = "http://localhost:80/PostName.php?name=";
//string getURL = "http://localhost:80/ReadName.php";
//string setURL = "https://s3.eu-central-1.amazonaws.com/com.datasbuck.mybucket/PostName.php?name=";
//string getURL = "https://s3.eu-central-1.amazonaws.com/com.datasbuck.mybucket/ReadName.php";
private string setURL = "http://bhamxr.com/PostName.php?name=";
private string getURL = "http://bhamxr.com/ReadName.php";
private void Update()
{
if (Input.GetKeyDown(KeyCode.J))
{
StartCoroutine(SendMessage(SendMgs));
Debug.Log("Message sent: " + SendMgs);
}
if (Input.GetKeyDown(KeyCode.K))
{
StartCoroutine(GetMessage());
Debug.Log("Message received: " + ReadMsg);
}
}
private IEnumerator SendMessage(string msg)
{
string URL = setURL + msg;
WWW www = new WWW(URL);
yield return www;
}
private IEnumerator GetMessage()
{
string URL = getURL;
WWW www = new WWW(URL);
yield return www;
ReadMsg = www.text;
}
}