The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Sending Http Headers throught HTml form post
Rating  5
parora
post Nov 26 2007, 04:24 PM
Post #1





Group: Members
Posts: 2
Joined: 26-November 07
Member No.: 4,399



How can i Send the custom Http headers in my request through html code.Is it possible?

Right now I have form post and my request can send the multi-part post with body. i want to add custom header names xyz with value xxx


How to do that ?

Hers my code to post

<html>
<head>
<title>Samples: Post a document</title>
<script language="JavaScript" type="text/javascript">
function setURL()
{
document.sendPOForm.action = document.getUrlForm.url.value;
}
</script>

<style type="text/css">
<!--
td { font-family: Verdana, Arial, sans-serif; font-size: 10pt }
button { width: 100; border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1}
input { width: 550; border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1}
-->
</style>
</head>
<body onload="document.getElementById('url').focus();">
<div align="center">
<center>
<table border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="2" cellspacing="0" width="800">
<tr>
<td width="150"><img border="0" src="images/CILogo.jpg" alt="Cast Iron Systems" width="150" height="93"></td>
<td valign="bottom" width="648"><b><font size="3">Post a document to the Cast Iron Integration Appliance</font></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">
<table border="1" cellpadding="4" cellspacing="1" width="100%" id="table2" bgcolor="#EFEFEF">
<tr>
<td>
<table border="0" cellpadding="2" cellspacing="1" style="border-collapse: collapse" width="100%" id="table3">
<form action="" method="" name="getUrlForm">
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td><b>URL of inbound connector:</b></td>
<td><input type="text" size="91" name="url" value="http://"/></td>
</tr>
</form>
<form action="" method="POST" enctype="multipart/form-data" name="sendPOForm" target="resultFrame">
<tr>
<td><b>Document to post:</b></td>
<td><input type="file" name="purchaseOrder" size="90"></td>
</tr>
<tr>
<td colspan="2" align="center"><button type="submit" onClick="java script:setURL()" name="Post" style="font-weight: bold">Submit</button>&nbsp;<button type="reset" name="Reset">Reset</button></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Nov 26 2007, 04:41 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



FWIW, our online validator reports structural problems with your markup.

But I think you're looking for <input type="hidden" ...>. See INPUT - Form Input in our HTML reference.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
parora
post Nov 26 2007, 05:00 PM
Post #3





Group: Members
Posts: 2
Joined: 26-November 07
Member No.: 4,399



QUOTE(Darin McGrew @ Nov 26 2007, 04:41 PM) *

FWIW, our online validator reports structural problems with your markup.

But I think you're looking for <input type="hidden" ...>. See INPUT - Form Input in our HTML reference.




This doesn't work as still when I capture headers on the server I get
<?xml version="1.0" ?>
- <httpheaders>
<uri>/test</uri>
<method>POST</method>
- <otherHeaders>
- <headerItem>
<name>Accept</name>
<value>*/*</value>
</headerItem>
- <headerItem>
<name>Accept-Encoding</name>
<value>gzip, deflate</value>
</headerItem>
- <headerItem>
<name>Accept-Language</name>
<value>en-us</value>
</headerItem>
- <headerItem>
<name>Cache-Control</name>
<value>no-cache</value>
</headerItem>
- <headerItem>
<name>Connection</name>
<value>Keep-Alive</value>
</headerItem>
- <headerItem>
<name>Content-Length</name>
<value>427</value>
</headerItem>
- <headerItem>
<name>Content-Type</name>
<value>multipart/form-data; boundary=---------------------------7d718d16b0db2</value>
</headerItem>
- <headerItem>
<name>Host</name>
<value>shadowcat:5080</value>
</headerItem>
- <headerItem>
<name>UA-CPU</name>
<value>x86</value>
</headerItem>
- <headerItem>
<name>User-Agent</name>
<value>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)</value>
</headerItem>
</otherHeaders>
</httpheaders>



I want to see header with name xyz and value xxx at server when sent throguh form. How to do that?

I am attaching my whole Html program with the post

This post has been edited by parora: Nov 26 2007, 05:01 PM


Attached File(s)
Attached File  HTTP_FilePost.zip ( 5.28k ) Number of downloads: 487
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 03:37 PM