Results 1 to 13 of 13

Thread: Executing PHP Script from VB6 *RESOLVED*

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2003
    Posts
    41

    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:
    1. Private Sub Command1_Click()
    2.     'text4 is just a url address
    3.     Winsock1.Connect Text4, 80
    4. End Sub
    5.  
    6. Private Sub Winsock1_Connect()
    7.     Dim strHttpRequest As String
    8.     Dim strPHP As String
    9.     strPHP = Text4 & "/vbMail.php"
    10.     strHttpRequest = "POST " & strPHP & " HTTP/1.0\r\n"
    11.     strHttpRequest = strHttpRequest _
    12.         & " Content-Length:65\r\n" & vbCrLf _
    13.         & " Content-Encoding: application/x-www-from-urlencoded\r\n\r\n" & vbCrLf _
    14.         & " Var1=Jesse&Var2=21&var3=Fort Collins" _
    15.         & vbCrLf
    16.     Winsock1.SendData strHttpRequest
    17. 'var1 var2 and var3 are the variables I am trying to send
    18. 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
  •  



Click Here to Expand Forum to Full Width