473,378 Members | 1,207 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,378 software developers and data experts.

Acquire php string in asp

From a programmer no longer available I have a file written in php which asks for a licensee name, which it names 'name'. At a Submit button it sends the user to another php file which includes the code

$licensee_name=$_GET['name']

I want to use vbscript, so as to incorporate existing code which generates a key. Using the website editor I have written a skeleton file with the extension asp, which runs OK but lacks the 'name' to work with.

My question is, how do I acquire in asp the string output of a php script?
Apr 22 '07 #1
10 1648
jhardman
3,406 Expert 2GB
have you tried
Expand|Select|Wrap|Line Numbers
  1. request("name")
? Try it. If that doesn't work, post more of the code. How is 'name' variable passed?

Jared
Apr 23 '07 #2
have you tried
Expand|Select|Wrap|Line Numbers
  1. request("name")
? Try it. If that doesn't work, post more of the code. How is 'name' variable passed?

Jared
Thanks for the response.

When per your suggestion I type ~ request("name") ~ into the file using the on-site editor, it just echoes that text.

Note that I am not using a vbscript editor. I am not compiling anything. I normally use just vb, in which my application runs on my computer or when compiled, uploaded, and downloaded. I have Visual Studio 2005 in an unopened box, and will open it if compiling is necessary, but perhaps it is not even needed, and it might be worth more on ebay if not opened. I am trying to just write a smidgeon of code using the on-site editor, no compiler The site is definitely asp-enabled.

The tail end of the existing receipt.php code, which also instructs PayPal to issue a receipt, is

$today = date("m/d/y");
echo ("<br>To retrieve a license code for the use of the program, please fill in below the name of the licensee and the date for the use of the program.<br><br>");
echo (" <form name=\"input\" action=\"form_action.asp\" method=\"get\">");
echo (" <label for=\"name\">Licensee Name:</label>");
echo (" <input type=\"text\" name=\"name\" id=\"name\" value=\"Your Name Here\">");
echo (" <label for=\"date\">License Date (mm/dd/yy):</label>");
echo (" <input type=\"text\" name=\"date\" id=\"date\" value=\"$today\">");
//echo (" <input type=\"submit\" value=\"submit\">");
//echo (" </form>");

This successfully asks for a name and a date. At a click on the Submit button it sends the user to form_action.php file (or, now, to form_action.asp) which includes the code

$licensee_name=$_GET['name']
$licensee_name=$_GET['date']

and pretends to generate a key. My remaining task is to insert code to encrypt the name and the date into a key for use of the application, which is written in vb, where it will be authenticated by identical encryption code. I have the core of the encryption code in vbscript. What I do not have in vbscript (for an asp version of form_action) is acquisition of 'name" and 'date' to start with.
Apr 23 '07 #3
Jared? Anyone? I need the advice.

Is vbsrpt like html and psp, so that it just runs on the web, needing no compilation?

If so, are conditioning statements required? What are they?

And then how do I pick up the output of the prior php script?

If not, do I need to dig into vbstudio to learn what to do?

Tell me, and I'll do it.

Al
Apr 24 '07 #4
jhardman
3,406 Expert 2GB
VBscript is a scripted language, which means it is never fully compiled, but runs on a script interpreter. In asp pages, it is the server (usually IIS, although Apache can be configured to interpret vbscript) which interprets the scripts. For IIS it is fairly simple to tell the server to look for vbscript code on any .asp file. I'm not sure what you mean by "conditioning statements", so maybe the answer is "no". all vbscript code in an asp page should be within:
Expand|Select|Wrap|Line Numbers
  1. <% 'here is my code %>
I'm still trying to figure out how the php is sending the output. I don't understand php all that well. Could you explain how the data is sent? I've never heard of anyone attempting what you are trying, but as long as the data is going thru regular http channels it should be within the request() collection.

try this asp file:
Expand|Select|Wrap|Line Numbers
  1. dim x
  2. for each x in request.form
  3.    response.write x & ": " & request.form("x") & "<br>" & vbNewLine
  4. next
  5.  
  6. for each x in request.querystring
  7.    response.write x & ": " & request.querystring("x") & "<br>" & vbNewLine
  8. next
  9.  
  10. for each x in request.cookies
  11.    response.write x & ": " & request.cookies("x") & "<br>" & vbNewLine
  12. next
  13.  
save this as "requestTest.asp" and send your form to it. This should list all of the data sent to this page.

Let me know if this helps.

Jared
Apr 24 '07 #5
Jared:

I see now that the symbols <% and %> enclosing the code (and nothing else?) make it work. (That’s what I meant by “conditioning.”)

With that done, the code you gave me returns

name:
date:

which are only the names of the requested fields, not the content.

You said “I don't understand php all that well. Could you explain how the data is sent?”

Neither do I, but I already gave you for the receipt.php script which asks for the name and date. It does produce boxes on screen with default entries <Your Name Here> and today’s date, each of which can be changed before pressing Submit.

If sent to form_action.php it arrives OK. That code is

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $licensee_name=$_GET['name']
  3. $licensee_name=$_GET['date']
  4. echo ("<br><b>Licensee Name: </b>$licensee_name");
  5. echo ("<br><b>License Date: </b>$license_date");
  6. ?>
So, what I need is the asp equivalent of GET. I need to acquire in asp the string which GET gets in php.

Al
Apr 24 '07 #6
Jason:

Progress report. By trial and error I discovered the following:

Of the 3 options you provided, 2 can be omitted. And, when the quote marks around x are omitted, giving

Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim x 
  3. for each x in request.querystring 
  4.     response.write x & ": " & request.querystring(x) & "<br>" & vbNewLine 
  5. next 
  6. %>
then the desired strings appear:

name: Your Name Here
date: 04/24/07

So we’re getting closer.

What I still need to do is set a vb string to be equal to the content of request.querystring(x).

Al
Apr 25 '07 #7
Jason:

Or, am I already there? Are request.querystring(1) and request.querystring(2) the vb strings I am looking for?

I’ll assume so and see what happens, next chance I get.

Al
Apr 25 '07 #8
jhardman
3,406 Expert 2GB
Jason:

Or, am I already there? Are request.querystring(1) and request.querystring(2) the vb strings I am looking for?

I’ll assume so and see what happens, next chance I get.

Al
Yes! Sorry, the quote marks were a stupid mistake. Now that you know how they are sent you can simplify the code even further. I wouldn't recommend using the numbers even though they will work. It would be better to say request.querystring("name") and request.querystring("date"). And since only the querystring had data, you can drop the ".querystring" (although a lot of people leave it in just to be exact).

You can use these request variables anywhere in the page, or you can store them in new variables:
Expand|Select|Wrap|Line Numbers
  1. dim name, date
  2. name = request("name")
  3. date = request("date")
Jared
Apr 26 '07 #9
Jared:

OK, got it. Thanks. By cut and try I have it working, up to the point of feeding the specified string into the encryption scheme.

But when I paste in the code which would come next if I were still in vb, then depending on what I comment out I get errors (running on the web server) like

Microsoft VBScript runtime error '800a01fa'
Class not defined: 'CMD5'

Microsoft VBScript runtime error '800a01a8'

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'CLng'

and trial and error is no help. Am I simply out of my depth, so that I need a consultant?

Al
Apr 27 '07 #10
jhardman
3,406 Expert 2GB
All of these errors are solvable. The part I thought would be tricky was communicating with the php, but since you got that done, you should be able to handle all of your problems like normal. Remember that VBScript is simpler than VB. All variables are "by val" so if you pass something in another format it will generate an error.

Post your code and I'll take a look at it.

Jared
May 7 '07 #11

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

Similar topics

1
by: Paul | last post by:
Hi I have seen this discussed already on the newgroup but have not seen if the problem is solved Using embedded python in c++ we use PyEval_RestoreThread(context); to acquire the GIL. We...
1
by: AngryGerbil | last post by:
hey, How do I acquire MethodInfo WITHOUT hardcoding method name as a string?!??!The fact I have to use xxx.Gettype.GetMethod("MyMethod", xxx) is making me want to drive an ice pick into my eye! I...
2
by: AMeador | last post by:
I have searched for the answer to this in many sources, but have not found a solution that works. I'm wondering if maybe I am missing a reference, or something. I added a reference to the project...
1
by: FMorales | last post by:
We need to access to a webcam in .net c# We need to show the video in a form from a web cam, and when push a buttom record it to a file ..... How can we do it ?? Samples on google (c#...
7
by: Julie | last post by:
According to the documentation for the Acquire methods on the ReaderWriterLock class: -1 Infinite. 0 No time-out. > 0 The number of milliseconds to wait. ...
8
by: AngryGerbil | last post by:
hey, How do I acquire MethodInfo WITHOUT hardcoding method name as a string?!??!The fact I have to use xxx.Gettype.GetMethod("MyMethod", xxx) is making me want to drive an ice pick into my eye! I...
4
by: jenue | last post by:
Hi evreryone! Is there a way to acquire information about the hardware firewall using wmi or anything? i'm having a problem with this scenario. can anyone you guys help me? thanks, jenue
10
by: Dmitriy V'jukov | last post by:
On 16 ÍÁÊ, 21:41, "Dmitriy V'jukov" <dvyu...@gmail.comwrote: According to definition, release operation on 'std::atomic_global_fence_compatibility' can only 'synchronize with' acquire...
0
by: faelnefal | last post by:
i have this code... List<Sample> list = new List<Sample>(); list.Add(new Sample("balloons")); list.Add(new Sample("candies")); IEnumerable...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.