Link to home
Start Free TrialLog in
Avatar of AsifBangash
AsifBangash

asked on

Sending Parameter to a PHP file from VB6

Hi All,

I've a small problem, I want to pass parameter to a specific PHP file for execution.

URL:(www.abc.com/main/this.php?e=25&tr=34)

so how can i pass that parameter to PHP file.
e.g:( e=45&tr=34 pass to a PHP file name 'index1.php'.)

Waiting for your Positive response.

sorry for points cause i have no more ponits.

thx
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

try use URLDownloadToFile API ?

Example:

Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    Dim lngRetVal As Long
    lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    If lngRetVal = 0 Then DownloadFile = True
End Function

Private Sub Form_Load()
    DownloadFile "http://www.abc.com/main/this.php?e=25&tr=34", "c:\temp.htm"
    if dir$("c:\temp.htm") <> "" then kill "c:\temp.htm"
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AsifBangash
AsifBangash

ASKER

Thx Ryancys But like to explain me what doing this code of (vbnet.mvps.org), Ryancys i just want to pass parameter to 'index1.php' file, like to make a procedure for me to do this work plz i m still hanging.

i just want to send after = value means rt=45&yy=999 so just send (45 and 999).

(: , i m in tension plz

thx
vbnet.mvps.org is doing the same thing as above example, what is additional is the vbnet.mvps.org's example call another API, to ensure that when we post a request, we NOT get the result from cache, and that ensures we really post the request to that URL.

The above DownloadFile in the example should fulfill your request to post parameters rt=45&yy=999 to a targeted web page (in this case, your 'index1.php').

>>rt=45&yy=999
It means you pass parameter of rt with value 45, and parameter of yy equals to 999 to the targeted web page. And it did send (45 and 999) to that web page.

Any problem or you need more explaination? ;-)
Ryancys plz like to make a simple code for me or mail me plz, i m waiting for u and i know that u'll solve it better.

thx
waiting for ur response.
Hi Asif,

The above code is simple as it is already, there is not big difference if i send you the code via email to you. And it's against EE Policy if we communicate via email but not via posting comments at EE website.

The code is ready for testing, didn't you try it out? Got any problem?

cheers
Thx for remember me the policy and i testing it wait.........
Rynacys

But this code is just download the the page and i want to upload the variables to php page so what is ur opinion.
What is meant by "upload the variables" ?

Isn't it your intension is to pass parameters to that URL ?
ok ryancys thats not my answer so don't mind. plz

my answer is

Dim link
Dim r
Dim t
r = "id=" & 2

link = ShellExecute(hwnd, "Open", "www.hotmail.com/uilogin.srf?" & r, &O0, &O0, SW_NORMAL)

Thx.