Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SIMULATE via code the message when i click on cerca

Status
Not open for further replies.
Clicking the Recerca button initiates the default Form action, which for this page is defined in the page's HTML as:

<FORM ACTION="sportelli_geo_out.html" method="POST">

And we've shown you before how to do GET and POST requests
 
Sorry bro, but i know only the get, method.
Please an example, tks
 
<sigh>

Code:
[COLOR=blue]Public Sub Sal21_101()
Dim myHTMLDoc As New HTMLDocument

With CreateObject("MSXML2.XMLHTTP")
    [COLOR=green]' Let's do a gGET first[/color]
    .Open "GET", "[URL unfurl="true"]https://italia.indettaglio.it/ita/banche/sportelli_geo.html?regione=trentinoaltoadige&regione_estesa=SARDEGNA",[/URL] False
    .Send
    myHTMLDoc.body.innerHTML = .responseText
    
   [COLOR=green] ' Do whatever you want with myHTMLDoc
     
    '<FORM ACTION="sportelli_geo_out.html" method="POST">[/color]
    .Open "POST", "[URL unfurl="true"]https://italia.indettaglio.it/ita/banche/sportelli_geo_out.html",[/URL] False
    .setRequestHeader "Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded"[/URL]
    .Send "comune=Cagliari"
    myHTMLDoc.body.innerHTML = .responseText
End With

End Sub[/color]
 
gREAT!
Tks strongm!

hummmmmm...

I save the result of .responseText i a txt file.

now i need to get all nodes of table.

my test code are here, but not work!

note:
I jus have set xml 3.0 object library in my preference

Option Explicit
Private Sub Command1_Click()

Dim myDOM As DOMDocument
Dim myItem As IXMLDOMElement
Dim fso As New FileSystemObject
Dim Instream As TextStream

Set myDOM = New DOMDocument
Set Instream = fso_OpenTextFile("C:\Lavori_Vb6\HTML_WEB_DROPDOWN\FILES\PROVINCE.TXT", ForReading)
myDOM.LoadXML Instream.ReadAll

For Each myItem In myDOM.getElementsByTagName("TD")

With myItem.ChildNodes
Debug.Print .Item(0).nodeName, .Item(0).Text
Debug.Print .Item(1).nodeName, .Item(1).Text
Debug.Print .Item(2).nodeName, .Item(2).Text
End With

Next

End Sub
Private Sub Command2_Click()

Dim myDOM As DOMDocument
Dim myItem As IXMLDOMElement
Dim lp As Long

Set myDOM = New DOMDocument

myDOM.Load "C:\Lavori_Vb6\HTML_WEB_DROPDOWN\FILES\PROVINCE.TXT"

For Each myItem In myDOM.getElementsByTagName("td")
Debug.Print myItem.nodeName, myItem.Text
Next

End Sub

 
srongm, resolved my self, the last question.

now, based this code:

Public Sub Sal21()

Dim myHTMLDoc As New HTMLDocument

With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "Abruzzo", False
.send
myHTMLDoc.body.innerHTML = .responseText

'Debug.Print .responseText

.Open "POST", " False

.setRequestHeader "Content-Type", "application/x- .send "prov_cap=AQ"

myHTMLDoc.body.innerHTML = .responseText

Debug.Print .responseText

End With

End Sub

in Debug.Print .responseText i have blank value from the table!
 
if you'd looked for the FORM info in the source HTML, you would have seen:

[tt]<FORM ACTION="cap_regione_out.html" method="POST">
<INPUT TYPE="HIDDEN" NAME="regione" VALUE="abruzzo">
<INPUT TYPE="HIDDEN" NAME="regione_estesa" VALUE="">[/tt]

That shows that there are two additional, hidden values that need to be sent (0in this case the two parameters you passed to the first page). Which translates as;

Code:
.Send "prov_cap=AQ&regione=abruzzo&regione_estesa="

Note this is ALL HTML stuff, not really VB6
 
Hi bro...

is this correct?

Public Sub Sal21_101()

Dim myHTMLDoc As New HTMLDocument

With CreateObject("MSXML2.XMLHTTP")

.Open "GET", " False
.send
myHTMLDoc.body.innerHTML = .responseText

Debug.Print .responseText

.Open "POST", " False
.setRequestHeader "Content-Type", "application/x- .send "capi_cap=80121"
myHTMLDoc.body.innerHTML = .responseText

Debug.Print .responseText

End With

End Sub

based:

and input in Cap, dropdpwn=80121

DONT WORK!

dont return the value of table, based on button ricerca.

Sorry
 
Here's the HTML FORM info for the page in question (which you could easily have found for yourself simply by looking at the page source):

[tt]<FORM ACTION="cap_citta_out.html" method="POST">
<INPUT TYPE="HIDDEN" NAME="regione" VALUE="campania">
<INPUT TYPE="HIDDEN" NAME="regione_estesa" VALUE="Campania">
<INPUT TYPE="HIDDEN" NAME="citta" VALUE="Napoli">[/tt]

Now, given the previous post of mine I'll leave you to work out the appropriate SEND.

 
ok
but i dont see the parameter for 80121

Plese can you modify my last code for....
 
Look at my previous post, 22 Nov 23 13:31, to see how to build the SEND including the parameter you additionally want to send along with the 'built-in' hidden parameters.

I've done the hard bit - how to do submit FORM data using VB - I'v e given you all the information you need, and now you need to do a miniscule bit of work yourself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top