Android Question jobPost.PostString

HarryPottier

Member
Licensed User
The following code makes me desperate.
I try to write to a text file on the xampp server.
But the existing "Daten.txt" remains unchanged
If the "Daten.txt" does not exist on the server, a strange error message appears
B4X:
Sub Activity_Create(FirstTime As Boolean)
    
    Dim SendString As String
    SendString = "This record should now be in Data.txt"
    
    Dim jobPost As HttpJob
    jobPost.Initialize("jobPost",Me)
    
    jobPost.PostString("http://192.168.178.54/Test/Daten.txt", SendString)
    
    If jobPost.Success = True Then
        ToastMessageShow("have been updated!", False)
    Else
        ToastMessageShow("Error: " & jobPost.ErrorMessage, True)
    End If
    
End Sub

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Object not found!</title>
<link rev="made" href="mailto:postmaster@localhost" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
body { color: #000000; background-color: #FFFFFF; }
a:link { color: #0000CC; }
p, address {margin-left: 3em;}
span {font-size: smaller;}
/*]]>*/--></style>
</head>
<body>
<h1>Object not found!</h1>
<p>
The requested URL was not found on this server.

If you entered the URL manually please check your
spelling and try again.

</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:postmaster@localhost">webmaster</a>.
</p>
<h2>Error 404</h2>
<address>
<a href="/">192.168.178.54</a><br />
<span>Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.4.4</span>
</address>
</body>
</html>
 

DonManfred

Expert
Licensed User
Longtime User
The receiver of Poststring must be a Servercomponent which does read the values. A PHP Script or similar.

You CAN NOT add text to a Textfile directly!
 
Upvote 0

HarryPottier

Member
Licensed User
Thank you
I no longer have an error message, but my message is not transmitted

“You CAN NOT add text to a Textfile directly!” 🤔

Erel:
I cannot find an entry for "jobPost.PostString" on the suggested page

How do I do it to send an information to the PC, just a string?
 
Upvote 0

HarryPottier

Member
Licensed User
The server is an xampp "192.168.178.54" "c:\xampp\htdocs\Android\
There I have created a folder with the name Android
I can also download files from there to the B4A without any problems.
Only vice versa I can't find a solution.
I have to transfer a string or a file in this folder to Android so that the PC knows what to provide.
 
Upvote 0
Top