Question post http request not sending data...?!?

danturn

New member
Joined
Mar 8, 2009
Messages
1
Programming Experience
Beginner
Hi guys,

I wrote a small VB script which sends a XML string to a cisco phone..

i'm trying to rewrite it in VB .net at the moment but am having some issues...

I know very little about vb .net so i'm sure i'm doing something monumentally stupid...

my code is here...


using System;
using MSXML2;
using System.IO;
using System.Net;
using System.Text;
using System.Net.Sockets;
namespace PP
{
class Program
{
public static void Main(string[] args)
{

string XML = "XML=<ciscoipphoneexecute><executeitem priority='0' url='Play:chime.raw'></ciscoipphoneexecute>";
byte[] auth = System.Text.ASCIIEncoding.UTF8.GetBytes("10014535" + ":" + "0250");

MSXML2.XMLHTTPClass xmlhttp = new MSXML2.XMLHTTPClass();
xmlhttp.open("Post", "http://192.168.1.5/CGI/Execute", true, "", "");
xmlhttp.setRequestHeader("Authorization", "Basic " + Convert.ToBase64String(auth));
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(XML);
}
}
}

my issue is that when i run this it doesn't send anything. When i run the vbscript i can use wireshark to sniff the packets to the phone and from the phone to the call manager... when i run this i get nothing :(

any help would be very very gratefully received!
 
I'm not familiar with the MSXML2 objects - I usually use HTTPRequests to POST data, but maybe you need to flush it or something? I'm not sure if you also need to specify the content length?
 
Back
Top