Sending a simple HTTP request

Camillia
Camillia used Ask the Experts™
on

I need to send a HTTP request that looks like this:

http://<ip>/web1?ANI=1120&NAME=Joe%20Smith&TOPIC=sales&WEBSITE=bweb.com

So, ANI, Name, Topic, Website are fields on the page. I  think I can just have a simple HTML page, with those fields and have the Form Action. Something like below but not sure:
<html> 
<head><title>Test page</title></head> 
<body> 
<form action="http://<ip>/web1?"> 
    <input type="text" value="1122"  
        id="ANI" name="ANI" /> 
    <br /> 
    <input type="text" value="Joe Smith"  
        id="Name" name="Name" /> 
    <br /> 
    <input type="text" value="Sales"  
        id="Topic" name="Topic" /> 
    <br /> 

    <input type="text" value="bweb.com"  
        id="website" name="website" /> 
    <br />

     

    <input type="submit" /> 
</form> 
</body> 
 
</html>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
You can even use it as the src of an image:

<img src="http://<ip>/web1?ANI=1120&NAME=Joe%20Smith&TOPIC=sales&WEBSITE=bweb.com" width="1" height="1" />

And it is not so hard to make that url return a transparent 1x1 pixel GIF image. For example using "Server.Transfer"
But that HTML way of doing it is correct as well?

that "%20" is because there's a space between Joe and Smith?

Commented:
URLEncode a <space> and it is %20. The "+" sign is also used (and valid).
Spaces are not valid in an url. That is why it is needed to encode (url-encode) them.

Thanks. I can use that HTML page, correct? This is just a test and I dont want to get fancy with it.  So, that HTML will do it, right?

Also, the URL will encode it, correct? I dont need to manually add that "%20"?
If you add the method attribute to you from tag, it will send the request through the url.


<html> 
<head><title>Test page</title></head> 
<body> 
<form action="http://<ip>/web1" method="get"> 
    <input type="text" value="1122"  
        id="ANI" name="ANI" /> 
    <br /> 
    <input type="text" value="Joe Smith"  
        id="Name" name="Name" /> 
    <br /> 
    <input type="text" value="Sales"  
        id="Topic" name="Topic" /> 
    <br /> 

    <input type="text" value="bweb.com"  
        id="website" name="website" /> 
    <br />

     

    <input type="submit" /> 
</form> 
</body> 
 
</html>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial