Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Go Back  Xtreme Visual Basic Talk > > > Posting data to VB6 Applicaion using PHP fsockopen


Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2010, 02:06 PM
Mabbs Mabbs is offline
Newcomer
 
Join Date: Oct 2010
Posts: 1
Default Posting data to VB6 Applicaion using PHP fsockopen


Hi there,

I wonder if anyone could provide an example of how topost some data to a VB6 app using PHP's fsockopen / fputs.

The PHP side:



Code:
<?php
$host = "123.123.123.123";
$port = "1234";
$fp = fsockopen ($host, $port, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "var1=one&var2=two&var3=three");
Sleep(5);
fclose ($fp);
}
?>
Let's Assume the VB side already accepts connections (using winsock) and using the code above, I am able to connect to the VB App server and disconnect after 5 seconds (using php sleep).

Let's take a look at the VB server side:


Code:
Sub SocketIsConnected(ByVal Index As Long, Optional ByVal var1 As String, Optional ByVal var2 As String, Optional ByVal var3 As String)
            If GetIP(Index) = "111.222.111.222" Then
            MsgBox "Received vars: " & var1 & var2 & var3
            End If
End Sub
What I am trying to achive is that my messagebox shows: Received vars: onetwothree if the connection comes from IP 111.222.111.222

Right now I can connect and I receive the Received vars: message (just wihout the values).

That said, since it's at least 6 years ago that I worked with VB6, I would welcome any help you could provide to get this working. Maybe the issue is that I pass the var's wrong from the PHP side, or that I missed something important to echo thevalues in in my app - I don't know.

My guess is that some important part on the VB side is missing which actually makes the vars pop up in my msgbox.

Thank you for talking time to have a look at this post and for any help you might be able to provide.
Reply With Quote
  #2  
Old 11-05-2010, 09:15 PM
axf axf is offline
Centurion
 
Join Date: Aug 2003
Location: SATX
Posts: 107
Default

You last visited: 10-01-2009 at 10:32 PM Woah, been a while.

Yes you are missing a critical part in your code which would be a function that parses the data sent from the PHP script into separate variables. Just because you send blah=foo&bar=cool wont create two variables in VB without the supporting code I know PHP, perl and others do but those are scripting languages meant for web stuff.

Enough ranting: You will need to get the data from the socket first, if you are familiar with Microsoft Winsock OCX control this is equivalent to socket1.GetData myvariablehere$

Next parse that data one of two ways: you can create your own function/sub routine or you can use Kevin O'Brien's wonderful module already written for VB6 that includes a lot more functions that just parsing.
http://pweb.netcom.com/~obrienk/index.html

I asked him many years ago if I could include this module in a few of my projects and was given the OK so I wouldn't see why we would deny your request.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
 
Posting data to VB6 Applicaion using PHP fsockopen
Posting data to VB6 Applicaion using PHP fsockopen
 
-->