Hey everyone,
I'm working on putting together a simple commandline utility post to my Twitter account.  Does anyone have an API to do a GET and/or POST request?  I know I can use the ATTACHBROWSER but I was worried about the overhead this may generate for CLI.
Thanks in advance.
			
			
			
				I have a partially working solution.  Below is some code to do an HTTP GET from a webserver I pulled from some IBasic code I foud and revised.  The only problem I have is that I can't get function to return a WSTRING, only a STRING.  Since its returning a string part of the page is getting cut off.  Any advice?
'Generic HTTP GET function based on Time update program
'created by: Jos de Jong, 2004
'created with: IBasic Professional
$main
$USE "wininet.lib"
'declare some API calls
SETID "INTERNET_SERVICE_FTP",1
SETID "INTERNET_SERVICE_GOPHER",2
SETID "INTERNET_SERVICE_HTTP",3
SETID "INTERNET_PRECONFIG",0
SETID "INTERNET_DIRECT",1
SETID "INTERNET_PROXY",3
SETID "INTERNET_FLAG_RELOAD",0x80000000
DECLARE "wininet",InternetOpenA(agent:string,access:int,proxyname:string,proxybypass:string,flags:int),int
DECLARE "wininet",InternetConnectA(session:int,server:string,port:word,username:string,pass:string,service:int,flags:int,context:int),int
DECLARE "wininet",InternetCloseHandle(handle:int),int
DECLARE "wininet",HttpOpenRequestA(session:int,verb:string,name:string,version:pointer,referer:string,types:pointer,flags:int,context:int),int
DECLARE "wininet",HttpSendRequestA(handle:int,headers:pointer,headerlength:int,option:pointer,optionlength:int),int
DECLARE "wininet",InternetReadFile(hfile:int,buffer:string,count:int,bytesread:pointer),int
DECLARE "wininet",InternetQueryDataAvailable(hfile:int,bytesavail:pointer,flags:int,context:int),int
sub OpenUrl(site$:string, doc$:string),STRING  ' When set to WSTRING, it always errors
DEF hopen,hconnect,hhttp:int
DEF buffer as WSTRING
DEF br,avail:int
DEF null:POINTER
DEF content as STRING
'if the url you want is "http://www.timeanddate.com/worldclock/index.html", then
'site$ must be "www.timeanddate.com"
'doc$ must be "worldclock/index.html"
'the doc$ refers to the actual document, directory or page being retrieved.
ref$ = "IBasic Pro"
content$ = ""
hopen = InternetOpenA(ref$,@INTERNET_PRECONFIG,"","",0)
IF hopen
	
	hconnect = InternetConnectA(hopen,site$,80,"","",@INTERNET_SERVICE_HTTP,0,0)
	IF hconnect
		
		hhttp = HttpOpenRequestA(hconnect,"GET",doc$,null,"",null,@INTERNET_FLAG_RELOAD,0)
		IF hhttp
			IF HttpSendRequestA(hhttp,null,0,null,0)
				
				DO
					InternetReadFile(hhttp,buffer,255,br)
					IF br > 0
						buffer$ = left$(buffer,br)
						content$ = content$ + buffer$
					ENDIF
					buffer$ = ""
				UNTIL br = 0
			ENDIF
			InternetCloseHandle(hhttp)
	
		ENDIF
		InternetCloseHandle(hconnect)
	
	ENDIF
	
	InternetCloseHandle(hopen)
ENDIF
return content$
endsub
print OpenURL("www.google.com", "/")
input ""
			
			
				Tekrat
I don't think your problem is with unicode strings.  Your not getting the entire page content because your content buffer is full.  Try changing "DEF content as STRING" to "DEF content[10000] as iSTRING" and you'll see what I mean.
Earn
			
			
			
				That worked, Thanks!!!
			
			
			
				nice contrib too tekrat, that should save me some of the effort of porting my VB code to do exactly that!