|
-
Feb 16th, 2005, 12:17 PM
#1
Thread Starter
Member
Executing PHP Script from VB6 *RESOLVED*
Hello,
I am trying to execute a PHP Script that sends an email populated with variable from a vb6 form. I am trying to use the post method, but not sure this is even the best way to accomplish my goal here is what I have:
VB Code:
Private Sub Command1_Click()
'text4 is just a url address
Winsock1.Connect Text4, 80
End Sub
Private Sub Winsock1_Connect()
Dim strHttpRequest As String
Dim strPHP As String
strPHP = Text4 & "/vbMail.php"
strHttpRequest = "POST " & strPHP & " HTTP/1.0\r\n"
strHttpRequest = strHttpRequest _
& " Content-Length:65\r\n" & vbCrLf _
& " Content-Encoding: application/x-www-from-urlencoded\r\n\r\n" & vbCrLf _
& " Var1=Jesse&Var2=21&var3=Fort Collins" _
& vbCrLf
Winsock1.SendData strHttpRequest
'var1 var2 and var3 are the variables I am trying to send
End Sub
my PHP Script is:
PHP Code:
function ReturnValue($Field) {
return $Field;
}
$msg = "Hello";
$msg .= ReturnValue($_POST[Var1]);
$msg .= ReturnValue($_POST[Var2]);
$msg .= ReturnValue($_POST[Var3]);
$recipient = "[email protected]";
$subject = "VB6";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Reply-To: [email][email protected][/email]";
mail($recipient,$subject,$msg,$headers);
?>
This does not work and I am new to PHP and very new to vb6 integrating with PHP. Thanks in advance for any help
Jesse
Last edited by wallacejww; Feb 21st, 2005 at 02:00 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|