B Baris Karadeniz Active Member Licensed User May 16, 2016 #1 I use PostString to get information from php file in the server but nothing happens with the codes below. It says job success true but nothing happens. Where can be my fault? Code: Dim Job2 As HttpJob Job2.Initialize("Job2", Me) Job2.PostString("http://www.xxx.com/yyy.php", "op=chat_new_messages&imei=11111111111111111") PHP file codes are below; Code: if (@$_GET["op"] == "chat_new_messages") { $imei = $_GET["imei"]; // get unread messages number $q = "SELECT * FROM `gs_tracker_chat` WHERE `imei`='".$imei."' AND `side`='S' AND `status`=0"; $r = mysql_query($q); $msg_num = mysql_numrows($r); // set messages to delivered $q = "UPDATE `gs_tracker_chat` SET `status`=1 WHERE `imei`='".$imei."' AND `side`='S' AND `status`=0"; $r = mysql_query($q); echo $msg_num; die; }
I use PostString to get information from php file in the server but nothing happens with the codes below. It says job success true but nothing happens. Where can be my fault? Code: Dim Job2 As HttpJob Job2.Initialize("Job2", Me) Job2.PostString("http://www.xxx.com/yyy.php", "op=chat_new_messages&imei=11111111111111111") PHP file codes are below; Code: if (@$_GET["op"] == "chat_new_messages") { $imei = $_GET["imei"]; // get unread messages number $q = "SELECT * FROM `gs_tracker_chat` WHERE `imei`='".$imei."' AND `side`='S' AND `status`=0"; $r = mysql_query($q); $msg_num = mysql_numrows($r); // set messages to delivered $q = "UPDATE `gs_tracker_chat` SET `status`=1 WHERE `imei`='".$imei."' AND `side`='S' AND `status`=0"; $r = mysql_query($q); echo $msg_num; die; }
Erel B4X founder Staff member Licensed User Longtime User May 17, 2016 #2 Note that your PHP script is open to SQL injections. What happens in JobDone sub? Where is the code? Why aren't you using B4J to implement the server side? Upvote 0
Note that your PHP script is open to SQL injections. What happens in JobDone sub? Where is the code? Why aren't you using B4J to implement the server side?
B Baris Karadeniz Active Member Licensed User May 17, 2016 #3 JobDone code is here; Code: Sub JobDone (Job As HttpJob) Log("JobName = " & Job.JobName & ", Success = " & Job.Success) If Job.Success = True Then Select Job.JobName Case "Job1" 'print the result to the logs 'Log(Job.GetString) Case "Job2" 'print the result to the log Log(Job.GetString) TextViewMessage.Text=Job.GetString End Select Else Log("Error: " & Job.ErrorMessage) End If Job.Release End Sub And the log is here; Class (b4i_httpjob) instance released. response success JobName = MyJob, Success = true Class (b4i_httpjob) instance released. response success JobName = Job2, Success = true Incorrect hardware key. Class (b4i_httpjob) instance released. In Job2 it says "Incorrect hardware key" but it is not related to our job. It gets this message because there is a problem with our target. Our target doesn't want hardware key. My code can not reach to the "op=chat_new_messages" So it jumps to another lines and receive "Incorrect hardware key". Why the line below doesn't see my request? Code: if (@$_GET["op"] == "chat_new_messages") Upvote 0
JobDone code is here; Code: Sub JobDone (Job As HttpJob) Log("JobName = " & Job.JobName & ", Success = " & Job.Success) If Job.Success = True Then Select Job.JobName Case "Job1" 'print the result to the logs 'Log(Job.GetString) Case "Job2" 'print the result to the log Log(Job.GetString) TextViewMessage.Text=Job.GetString End Select Else Log("Error: " & Job.ErrorMessage) End If Job.Release End Sub And the log is here; Class (b4i_httpjob) instance released. response success JobName = MyJob, Success = true Class (b4i_httpjob) instance released. response success JobName = Job2, Success = true Incorrect hardware key. Class (b4i_httpjob) instance released. In Job2 it says "Incorrect hardware key" but it is not related to our job. It gets this message because there is a problem with our target. Our target doesn't want hardware key. My code can not reach to the "op=chat_new_messages" So it jumps to another lines and receive "Incorrect hardware key". Why the line below doesn't see my request? Code: if (@$_GET["op"] == "chat_new_messages")
B Baris Karadeniz Active Member Licensed User May 17, 2016 #4 According to the php script if there is 1 new message Log(Job.GetString) should be 1, if there are 2 new messages Log(Job.GetString) should be 2, ...3, 3... But it gets nothing. Upvote 0
According to the php script if there is 1 new message Log(Job.GetString) should be 1, if there are 2 new messages Log(Job.GetString) should be 2, ...3, 3... But it gets nothing.
B Baris Karadeniz Active Member Licensed User May 17, 2016 #5 I solved this. Now I receive number of new messages. But I have another question; how can I see the content of the new messages? Which and how parameter I should write to the download code? Code: Dim Job3 As HttpJob Job3.Initialize("Job3", Me) Job3.Download2("http://www.xxx.com/yyy.php", Array As String("op", "chat_new_messages", "imei", "111111111111")) PARAMETERS??? End Sub Upvote 0
I solved this. Now I receive number of new messages. But I have another question; how can I see the content of the new messages? Which and how parameter I should write to the download code? Code: Dim Job3 As HttpJob Job3.Initialize("Job3", Me) Job3.Download2("http://www.xxx.com/yyy.php", Array As String("op", "chat_new_messages", "imei", "111111111111")) PARAMETERS??? End Sub
Erel B4X founder Staff member Licensed User Longtime User May 17, 2016 #6 Please start a new thread for a new question. Upvote 0