troubleshooting Question

using UploadStringAsync(String URI,String msg)

Avatar of sgaggerj
sgaggerjFlag for United States of America asked on
Visual Basic.NET
2 Comments1 Solution1902 ViewsLast Modified:
Hi all!

I am using the code below to send a message to my php script
i am having a couple of problems.

first, i cannot get it to send the string (msg) - if i put the arguments i want to pass in the addr variable, then those get sent correctly.  the way i have it now is ok if i can get the message (msg) to send.

secondly i am looking for advice.  this program is monitoring a data stream and every so often adds 1 character to a string.  when that string length gets to be 254, the string gets added to a array of strings that is 512 entries long, is emptied and new data gets added to it.  is it possible to send the contents of the array as the message? or am i going to end up looping through this 512 times (or however many entries are in the array when the timer kicks off).  Would i be better off just sending the msg when the length gets to be 254?

and a final thought - if i keep msg to "", and in the I.UploadStringAsync(addr, msg) call i change it to
I.UploadStringAsync(addr + comments, msg)
will that cause a problem as the total length of addr + comments could be greater than 255

My VB.NET code:

Private Sub SendMessageNow(ByVal full As Boolean)

        Dim name As String = System.Environment.UserName
        Dim subject As String = Now.ToString
        Dim I As New System.Net.WebClient
' here i have tried ="TESTING", ="comments=TESTING",="&comments=TESTING", etc
        Dim msg As String = "comments=TESTING"
'if the name and subject are put in 'addr' then they get sent ok
' here i have tried with and without the + "&comments="
        Dim addr As New Uri("http://mydomain.com/send.php?name=" + name + "&subject=" + subject)
       
        I.UploadStringAsync(addr, msg)

        ReDim lgBuffer(512)

        marker = 0
        My.Application.DoEvents()
    End Sub

***** Here is the code in my PHP script

$name = $_GET['name'] ;
$subject = $_GET['subject'] ;
// here i have tried both $_GET and $_POST
$comments = $_POST['comments'] ;
// comments is always delivered as ""
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros