473,386 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Naming Form-Data

When sending form-data via post, the code to name it (I believe) is <form name="somename">.

If I interpret that correctly, that is the name of the full packet of data contained within the form tags.

I need to send multipart/form-data via POST; and I need the name to be xmlmsg.
The problem is, I'm using VBA (from access 2003).

I can do the whole POST thing fine, but setting the request headers is proving troublesome.

I've tried posting in the access/vba forums but I haven't had any responses in over a week, so I guess either no one knows; or I worded it very badly.

I've tried all the below. (One at a time, obviously). Could someone possibly tell me where I've gone wrong here?

Expand|Select|Wrap|Line Numbers
  1. SetRequestHeader="Content-Disposition", "form-data: name=""xmlmsg""" 
  2. SetRequestHeader="Content-Disposition", "name=""xmlmsg""" 
  3. SetRequestHeader="Content-Disposition", "name='xmlmsg'" 
  4. SetRequestHeader="Content-Disposition", "name=xmlmsg" 
  5. SetRequestHeader="ContentDisposition", "name=""xmlmsg""" 
  6. SetRequestHeader="name", "xmlmsg" 
  7.  
I've searched through google and the above is the results of my unsuccessful searches.

I apologise if my posting here annoys someone, (wrong board or whatever), but I'm having no luck anywhere else and I figured someone who knows html might know how to set headers in VBA.

Thanks
Mandi
Sep 29 '08 #1
4 1647
acoder
16,027 Expert Mod 8TB
See if this link helps.
Sep 29 '08 #2
See if this link helps.

Unfortunately not I'm afraid :(

I emailed the people who sent me the spec for this, and they didn't even have the decency to look at my name. The response was similar to "He should use the example we sent."

1, how many blokes do you know called Mandi?
2, I've already told them, twice, that I use VBA and haven't got any way to change that at the moment. Their examples are php and .NET. GAH!

Thanks anyway.
Mandi
Oct 3 '08 #3
acoder
16,027 Expert Mod 8TB
Show the PHP example. Maybe it could be converted. Any reason why you must use VBA?
Oct 4 '08 #4
I have nowhere to host PHP reliably at the moment; and I don't have the software to use the .NET example they gave me. All I can reliably use is VBA.

Here's the php they gave me; copied straight from their documentation but with the website removed for privacy etc.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $td_sku="1088963";
  3. //Following the XML data
  4. $xmldata="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r
  5. <OnlineCheck>\r
  6. <Header>\r
  7. <BuyerAccountId>------</BuyerAccountId>\r
  8. <AuthCode>---------</AuthCode>\r
  9. <Type>Full</Type>\r
  10. </Header>\r
  11. <Item line=\"1\">\r
  12. <ManufacturerItemIdentifier/>\r
  13. <ResellerItemIdentifier/>\r
  14. <DistributorItemIdentifier>$td_sku</DistributorItemIdentifier>\r
  15. <Quantity>1</Quantity>\r
  16. </Item>\r
  17. </OnlineCheck>";
  18. $fp = fsockopen("somewebsite.com", 8080, $errno, $errstr, 15);
  19. //Generate the postdata on a valid way, $out4 needs to be calculated, so will be later.
  20. $out1 = "POST /Onlchk HTTP/1.0\r
  21. ";
  22. $out2 = "Content-Type: multipart/form-data; boundary=---------------------------2\r
  23. ";
  24. $out3 = "Host: somewebsite.com:8080\r
  25. ";
  26. $out5 = "Connection: close\r
  27. \r
  28. ";
  29. $out6 = "-----------------------------2\r
  30. ";
  31. $out7 = "Content-Disposition: form-data; name=\"onlinecheck\"\r
  32. \r
  33. ";
  34. $out8 = "\r
  35. -----------------------------2--";
  36. //Calculation of the Content-Length:
  37. $tlen=strlen($out6)+strlen($out7)+strlen($xmldata)+strlen($out8);
  38. $out4 = "Content-Length: $tlen\r
  39. ";
  40. //Generate full output
  41. $out = $out1.$out2.$out3.$out4.$out5.$out6.$out7.$xmldata.$out8;
  42. fwrite($fp, $out);
  43. $retval = "";
  44. while(!feof($fp)){$retval = "$retval".fgets($fp,128);}
  45. fclose($fp);
  46. list($headers,$body) = explode("<?xml version=\"1.0\" encoding=\"UTF-8\"?>",$retval);
  47. $doc = new DOMDocument();
  48. $doc ->LoadXML($body);
  49. $item_ids = $doc->getElementsByTagname( "OnlineCheck" );
  50. foreach( $item_ids as $item )
  51. {
  52. $error_s = $item->getElementsByTagName( "Errorstatus" ); $tderror = $error_s->item(0)->nodeValue;
  53. $stock_s = $item->getElementsByTagName( "AvailabilityTotal" ); $tdstock = $stock_s->item(0)->nodeValue;
  54. // Reformatting the price to ISO compatible format
  55. $price_s = $item->getElementsByTagName( "UnitPriceAmount" ); $tdprice = str_replace('.','',$price_s->item(0)->nodeValue);
  56. $tdprice=str_replace(',','.',$tdprice);
  57. }
  58. //Rest of handling off the data under here
  59. ?>
  60.  
Oct 8 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
18
by: Michal Mieszkowski | last post by:
i have a block of html code looking like this <FORM name=myform> <INPUT type=text name=firstname> <DIV id=mydiv> <INPUT type=text name=address> </DIV> </FORM> i can access firstname field...
7
by: DEX | last post by:
Main page of my NC: http://www.ddmrm.com/coding/cpp/naming/cpp.naming.main.html Rules of my NC: http://www.ddmrm.com/coding/cpp/naming/cpp.naming.rules.html Comments are welcome. ...
11
by: Tom | last post by:
Hi all, I posted the same question one week ago in http://communities.microsoft.com/newsgroups/previewFrame.as p? ICP=msdn&sLCID=us&sgroupURL=microsoft.public.dotnet.framewo...
21
by: Just Me | last post by:
I've tried in a few places using a variable name Form and it appears to be OK. For example: Public Shared Sub WritePositionsInRegistry(ByVal Form As Form, ByVal SubkeyName As String) Is it OK...
9
by: kevininstructor | last post by:
Greetings, I am in the process of creating naming conventions for VB.NET controls i.e. CheckBox -> chkShowThisOnStartup ListBoxt -> lstSomeList What I am looking for other developers...
4
by: Sturdy | last post by:
Hi, I'm new to C# and .NET. I'm a first time user of Visual C# 2005 Express and have a very basic question. I've looked at several links and lots of docs but can't find any tips on naming multiple...
0
by: paul.hester | last post by:
Hi all, I can't find a consistent naming convention rule for form elements and/or server controls with ASP .NET 2.0. What conventions do you generally use? For example, for a user name text...
35
by: Smithers | last post by:
Is it common practise to begin the name of form classes with "frm" (e.g., frmOneForm, frmAnotherForm). Or is that generally considered an outdated convention? If not "frm" what is a common or...
23
by: Thorsten Kampe | last post by:
Okay, I hear you saying 'not another naming conventions thread'. I've read through Google and the 'naming conventions' threads were rather *spelling conventions* threads. I'm not interested...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.