iOS Question Poststring

Baris Karadeniz

Active Member
Licensed User
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?

B4X:
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;

B4X:
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;
    }
 

Baris Karadeniz

Active Member
Licensed User
JobDone code is here;

B4X:
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?

B4X:
if (@$_GET["op"] == "chat_new_messages")
 
Upvote 0

Baris Karadeniz

Active Member
Licensed User
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

Baris Karadeniz

Active Member
Licensed User
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?

B4X:
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
Top