Solved

HTTP Post via URL

Posted on 2016-08-22
4
22 Views
Last Modified: 2016-09-23
I have the below code i have been using for ages, that long that ive forgotten how to submit information via a URL to it rather than through an app.

Can anyone let me know what i have to type to get info out on the other end please.


<%
Dim TN,FN,SN,TL,EM,PC,NT,CT,ES,RV,LT,TT,AT,RF, stext

Dim fs, file

fs=Server.CreateObject("Scripting.FileSystemObject")
file=fs.CreateTextFile("C:\test\upload\" & request.form("Reference") & ".txt",true)

TN = request.form("TradingName")
FN = request.form("firstname")
SN = request.form("surname")
TL= request.form("Tel")
EM = request.form("Email")
PC = request.form("PostCode")
NT = request.form("Notes")
CT = request.form("CompanyType")
ES = request.form("Established")
RV = request.form("Revenue")
LT = request.form("LeadType")
TT = request.form("TTD")
AT = request.form("ATV")
RF = request.form("Reference")

AT = Replace(AT, "#"  , "")
AT = Replace(AT, """"  , "")
AT = Replace(AT, "£"  , "")
AT = Replace(AT, "&quot;", "")
AT = Replace(AT, "&lt;"  , Chr(60))
AT = Replace(AT, "&gt;"  , Chr(62))
AT = Replace(AT, "&amp;" , Chr(38))
AT = Replace(AT, "&nbsp;", Chr(32))

file.write("""")
file.write(TN)
file.write(""",""")
file.write(FN)
file.write(""",""")
file.write(SN)
file.write(""",""")
file.write(TL)
file.write(""",""")
file.write(EM)
file.write(""",""")
file.write(PC)
file.write(""",""")
file.write(NT)
file.write(""",""")
file.write(CT)
file.write(""",""")
file.write(ES)
file.write(""",""")
file.write(RV)
file.write(""",""")
file.write(LT)
file.write(""",""")
file.write(TT)
file.write(""",""")
file.write(AT)
file.write(""",""")
file.write(RF)
file.write("""")


file.close
file=nothing
fs=nothing
 %>

Open in new window

Post Completed
0
Comment
Question by:CaptainGiblets
  • 2
4 Comments
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 500 total points
ID: 41765513
>Can anyone let me know what i have to type to get info out on the other end please.

Where you see request.form("some_name") that is a form field name that has to be posted.

As example
file=fs.CreateTextFile("C:\test\upload\" & request.form("Reference") & ".txt",true)

Open in new window


refers to a file and that file has a name that you provide via the form field called, "Reference".  If the reference field is submitted as "abc_test" then the code would look for C:\test\upload\abc_test.txt.
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 41765527
the code works, we have a 3rd party sending us information on a daily basis, however i need to make some changes to the coding to remove quote marks, i am sure i used to test what information came through by typing in the URL and then ?reference=123456&firstname=Testing

however this is currently just bringing up a blank file.
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 41765543
That's correct.  The code is looking for a form post (request.form).  If you used ?reference=123456&firstname=Testing the page would need to change from request.form to request.querystring.

Recreate a form with those form field names and post to that page to test.

I suggest a function to clean remove your quotes.  Then instead of
TN = request.form("TradingName")

Open in new window

you can use
TN = function clean_html(request.form("TradingName"))

Open in new window

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Query to get the soonest date out of a few records 2 51
ASP/VB email question 4 46
Code Manager | Snippits 2 35
Executing a script on a timer online 5 20
Introduction One of the frequent application design questions goes something like this: "How can I confirm when a client registers on my web site?" The registration might be for general use of a self-administered site like a forum, or for attend…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question