View Full Version : MvCALL passing variables
I haven't used this tag much so I need a little help. If I want to login to a site with mvcall and pass the login name and password, what is the proper format.
<MvASSIGN NAME = "txtUserId" VALUE = "{ 's344er' }">
<MvASSIGN NAME = "password" VALUE = "{ 'psdef' }">
<MvASSIGN NAME = "field1" VALUE = "{ 'txtUserId' }">
<MvASSIGN NAME = "field2" VALUE = "{ 'password' }">
<MvCALL ACTION="{ 'http://smtp.mysite.com/cares/CustVfy.asp' }" METHOD="POST" FIELDS="field1,field2">
I thought that since I new the names of the vars that I would pass them in another variable but that failed. I also tried send that acual values but that didn't work either.
Thanks
Kent Multer
04-11-06, 10:55 PM
The correct syntax would be:
<MvASSIGN NAME = "txtUserId" VALUE = "{ 'ActualUserName' }">
<MvASSIGN NAME = "password" VALUE = "{ 'ActualPassword' }">
<MvCALL ACTION="{ 'http://smtp.mysite.com/cares/CustVfy.asp' }" METHOD="POST" FIELDS="txtUserId,password">
So you have to use variables whose names match the fields that your server is expecting to receive. If you tried that, and it didn't work, there must be something else wrong ...
I had tried that form and it didn't work. When I look at the source of the login page the <form Statment looks a little different. I suspect these also need to be passed. I tried setting them as vars in fields but the failure was the same. Any ideas?
<form action="CustVfy.asp" method="post" id="frmGetCust" name="GetCust" onsubmit="return isValidLogIn()">
Dramatic
04-13-06, 10:42 PM
The variable names used in the MvCALL must be exactly those referenced by the receiving server, so they must be unscoped, even if there is Miva at the other end. Its a good idea to consider them case-sensitive too.
The other thing that stands out is the acton of your call - are you really psting to a mailserver? (smtp)
Thanks for the input. Yes that really is an smtp server running this program. I have tried a meriad of things and so far all I get back is:
<html>
<head>
<title>
Error
</title>
</head>
<body>
The parameter is incorrect.
</body>
</html>
Here is the form and input statements that I got the info from:
<form action="CustVfy.asp" method="post" id="frmGetCust" name="GetCust" onsubmit="return isValidLogIn()">
<input type=hidden id="txtOldPass" name="txtOldPass" maxlength="3" value=>
<input id="txtUserId" name="txtUserId" maxLength="30" title="Name" selected value=>
<input type="password" id="txtPassWord" name="txtPassWord" title="Your password" value= onclick="funclear ()" onfocus="funclear ()">
<input id="CallGetCust" type="submit" value="Submit" name="CallGetCust" title="Log in">
</form>
This is the latest try.
<MvASSIGN NAME = "txtUserId" VALUE = "{ 'ZZZZZZ' }">
<MvASSIGN NAME = "txtPassWord" VALUE = "{ 'XXXXXX' }">
<MvASSIGN NAME = "txtOldPass" VALUE = "{ '' }">
<MvASSIGN NAME = "id" VALUE = "{ 'frmGetCust' }">
<MvASSIGN NAME = "name" VALUE = "{ 'GetCust' }">
<MvASSIGN NAME = "onsubmit" VALUE = "{ 'return isValidLogIn()' }">
<MvASSIGN NAME = "method" VALUE = "{ 'post' }">
<MvASSIGN NAME = "callString" VALUE = "{ 'http://smtp.jensenonline.com/cares/CustVfy.asp id=\"frmGetCust\" name=\"GetCust\" onsubmit=\"return isValidLogIn()\"' }" METHOD="POST" FIELDS="txtUserId,txtPassWord,txtOldPass">
Start MvCall<BR>
<MvCALL ACTION="{'http://smtp.server.com/cares/CustVfy.asp method=\"post\"'}" METHOD="POST" FIELDS="id,name,onsubmit,txtUserId,txtPassWord,txtOldPass">
<MvEXPORT FILE="test2.dat" Fields="callvalue" DELIMITER="|">
<MvEVAL EXPR="{ callvalue }">
</MvCALL>
If you have any ideas I'll gladly try anything. I desperately need to make this work.
Thanks
Dramatic
04-14-06, 04:06 AM
Here is the form and input statements that I got the info from:
<form action="CustVfy.asp" method="post" id="frmGetCust" name="GetCust" onsubmit="return isValidLogIn()">
<input type=hidden id="txtOldPass" name="txtOldPass" maxlength="3" value=>
<input id="txtUserId" name="txtUserId" maxLength="30" title="Name" selected value=>
<input type="password" id="txtPassWord" name="txtPassWord" title="Your password" value= onclick="funclear ()" onfocus="funclear ()">
<input id="CallGetCust" type="submit" value="Submit" name="CallGetCust" title="Log in">
</form>
Start MvCall<BR>
<MvCALL ACTION="{'http://smtp.server.com/cares/CustVfy.asp method=\"post\"'}" METHOD="POST" FIELDS="id,name,onsubmit,txtUserId,txtPassWord,txtOldPass">
<MvEXPORT FILE="test2.dat" Fields="callvalue" DELIMITER="|">
<MvEVAL EXPR="{ callvalue }">
</MvCALL>
Thanks
It would be helpful if the receiving script said which aprameter is incorrect!
But you are getting a response, which indicates that the server is listening on port 80 (not standard for a mailserver).
Ok, first off lose the method=\"post\" - it isn't needed because the METHOD parameter of MvCALL does that bit. - I'm surprised it isn't causing an error in your script, because of the illegal space in the action url.
Secondly, lose the ID, NAME and onsubmit fields. The onsumbit is only a client side javascript instruction to do some validation before sending (useless in an MvCALL), and the ID and Name of a form are never sent to the server as part of the Postdata.
BUT, when a submit element has a name and value, these are tramsmitted as postdata, and your MvCALL is missing them.
try adding <MvASSIGN NAME="CallGetCust" VALUE="Log in"> and adding CallGetCust to the list of fields you send.
Last note: you only need curly brackets in a Miva expression if what gore between them is an expression that must be evaluated for processing. If it is only a literal, then <MvCALL ACTION="{'http://smtp.server.com/cares/CustVfy.asp'}" is the same as
<MvCALL ACTION="http://smtp.server.com/cares/CustVfy.asp"
but the latter is shorter to type and may process marginally faster.
I did what you suggested and we're a lot closer. The final code looks like:
<MvCALL ACTION="http://smtp.server.com/cares/CustVfy.asp" METHOD="POST" FIELDS="CallGetCust,txtUserId,txtPassWord,txtOldPass">
The results I got back are:
Object Moved
</h1>
This object may be found
<a HREF="Menu.asp?CNo=983443&CName=TW-Farm-N-Home-Supply-Ctr-Inc&Ename=&OrdFl=&Ct=">
here</a>
I think the problem is that their scripts are running relative becuase if I take the menu.asp string and plug it into a brower window with the "http" stuff in front of it, surprise I get a very similar result. It is probably something they built in to detect if I bookmarked a page inside so I am forced back to the login page.
Do you think there is away around this or am I pushing against a rope?
Thanks again for all the help.
Dramatic
04-14-06, 07:35 AM
I did what you suggested and we're a lot closer. The final code looks like:
<MvCALL ACTION="http://smtp.server.com/cares/CustVfy.asp" METHOD="POST" FIELDS="CallGetCust,txtUserId,txtPassWord,txtOldPass">
The results I got back are:
Object Moved
</h1>
This object may be found
<a HREF="Menu.asp?CNo=983443&CName=TW-Farm-N-Home-Supply-Ctr-Inc&Ename=&OrdFl=&Ct=">
here</a>
Have you actually established with the operator of this script that the server will accept posts from remote IP's? Some are configured not to. For example, the NZ white pages and yellow pages both force you to the home page if you try and create a search field for them in your browser UI. (A chance to show 1 more ad!)
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.