Page 1 of 1

Converting ASP to PHP

Posted: Mon Nov 24, 2003 10:14 pm
by Greg1680
Tried to conver the following ASP to PHP:

<%
If Request("btnSubmit") = "Submit" Then
strPPID = Request.Form("txtPPID")
strCID = Request.Form("txtCompany")
strUID = Request.Form("txtUserID")
strPWD = Request.Form("txtPassword")

Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

objHTTP.setTimeouts 0, 60000, 300000, 3600000
objHTTP.Open "POST", "https://www.website.com/GetSessionID.asp", False
objHTTP.setRequestHeader "content-type", "application/x-www-form-urlencoded"
objHTTP.send "PPID=" & strPPID & "&CID=" & strCID & "&UID=" & strUID & "&PWD=" & strPWD

strSessionID = objHTTP.responseText

Set objHTTP = Nothing

If Len(strSessionID) > 0 then
%>
<%
Else
%>
<%
End if
Else
%>
<%
End If
%>

And got:

<?
if (${"btnSubmit"}=="Submit")
{

$strPPID=$HTTP_POST_VARS["txtPPID"];
$strCID=$HTTP_POST_VARS["txtCompany"];
$strUID=$HTTP_POST_VARS["txtUserID"];
$strPWD=$HTTP_POST_VARS["txtPassword"];

// $objHTTP is of type "MSXML2.ServerXMLHTTP"


$objHTTP->setTimeouts0
$objHTTP->Open"POST"//https://www.website.com/GetSessionID.asp", False
$objHTTP->setRequestHeader"content-type"//application/x-www-form-urlencoded"
$objHTTP->send"PPID=".$strPPID."&CID=".$strCID."&UID=".$strUID."&PWD=".$strPWD;

$strSessionID=$objHTTP->responseText;

$objHTTP=null;


if (strlen($strSessionID)>0)
{

?>
<?
}
else
{

?>
<?
}

}
else
{

?>
<?
}

?>

I think my syntax is not correct at the top. I used an application, as I am totally clueless when it comes to PHP.

Please advise.