Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
POST Multipart data from InternetExplorer.Application
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01132344
Message ID:
01132836
Views:
16
Don,

What version of VFP are you using? Prior to VFP 9 dealing with POST data in IE is very unpredictable and wouldn't work.

The other issue (the more likely one) is that you need to pass BINARY data to the post buffer not a string. You can use STRCONV() to turn the data into a BinHex string or use CreateBinary().

I agree with Malcom though - using IE to do a programmatic submission like this is not a good idea for an applicatino. There should be free code around to do this with XmlHttp, WinHttp here as well so wwIpStuff and wwHttp in particular are not a requirement although it makes it real easy.

Aloha,

+++ Rick ---


>Hi all,
>
>I'm working on a project... Don't WANT to force users to install other party utilities, libraries, etc, so I'm considering just using the Internet Explorer...
>
>I need to push data (actually XML content) up to a website ex: //localhost/mysite/mypage.aspx
>
>I can create the IE object via oIE = createobject("InternetExplorer.Application"), but I'm stuck with the posting of the XML string... for obvious reasons, if I'm uploading a table, or even multiple table schema via XML, that won't work well via the query string. So I went to the direction of "Multipart" form/data. I have the boundary definition, etc.
>
>The headers I have identify the multi-part boundary info
>
>
>When I try the oIE.Navigate( url, "", "", lcPostData, lcHeaders ), I get to the debugger of the .aspx page, but looking everywhere, I don't see any identifier to the XML. I check the type of request and it shows "GET" instead of "POST".
>
>So, I try adding the header to identify the "Content-Length", and then I get NO response.. IE just hangs until I hit escape...
>
>
>
>LOCAL oIE as InternetExplorer.Application
>LOCAL loXMLAdapter as XMLAdapter
>LOCAL lcXML as String
>
>SELECT a1.*;
>	FROM MyDataDir\MyTable a1;
>	INTO CURSOR C_SendToWeb
>	
>loXMLAdapter	= NEWOBJECT( "XMLAdapter" )
>lcXML	= ""
>WITH loXMLAdapter
>	*/ Add schema per table/cursor
>	.AddTableSchema( "C_SendToWeb" )
>	.ToXML( "lcXML" )
>	.ReleaseXML()
>ENDWITH
>USE IN SELECT( "C_SendToWeb" )
>USE IN SELECT( "MyTable" )
>
>
>#DEFINE dcCRLF CHR(13)+CHR(10)
>#DEFINE MULTIPART_BOUNDARY		"---------------CompleX12345BounDary67890DR"
>
>lcPostData	= "--" + MULTIPART_BOUNDARY + dcCRLF;
>			+ [Content-Disposition: form-data; name="]+ [TableXML]+["];
>			+ dcCRLF + dcCRLF + lcXML ;
>			+ "--" + MULTIPART_BOUNDARY + dcCRLF + dcCRLF
>lnPostSize	 = LEN(lcPostData )
>
>lcHeaders	= ""
>lcHeaders	= lcHeaders + "Content-Type: multipart/form-data; boundary=" + MULTIPART_BOUNDARY ;
>			+ dcCRLF + dcCRLF
>lcHeaders	= lcHeaders + "Content-Length: " + ALLTRIM( STR( lnPostSize )) + dcCRLF
>
>lcMyPage = "http://localhost/MySite/MyPage.aspx"
>
>oIE = CreateObject("InternetExplorer.Application")
>oIE.Navigate( lcURL, 0, "", @lcPostData, @lcHeaders )
>DO WHILE oIE.ReadyState <> 4
>	WAIT WINDOW "test" TIMEOUT 1
>ENDDO
>WAIT CLEAR
>
>
>
>
>Again, if I post WITHOUT using the Content-Length, I get a response... add the content-length it hangs... Any ideas?
>
>Thanks
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform