2 messages in org.openoffice.fr.progRE : [prog] Récupération de page html
FromSent OnAttachments
Ludovic CHEVALIERJan 26, 2007 10:38 am 
michel tanguyJan 26, 2007 10:07 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:RE : [prog] Récupération de page htmlActions...
From:michel tanguy (bugb@club-internet.fr)
Date:Jan 26, 2007 10:07:46 pm
List:org.openoffice.fr.prog

Bonjour

Tu peux tester ce type de procédure pour accéder à une page(à condition d'utiliser Internet Explorer) :

Sub RemplissageChamps_PageHtml_IE( ) Dim oObj As Object Dim IE As Object Dim MaPageHtml As Object , Helem As Object

oObj = createUnoService( "com.sun.star.bridge.OleObjectFactory")

IE = oObj.createInstance("InternetExplorer.Application.1")

'Indiquez False pour masquer la fenêtre Internet Explorer pendant l'opération IE.Visible = True IE.Navigate("http://www.MonSiteWeb.fr/")

'Attend la fin du chargement de la page avant de poursuivre la procédure Do Until IE.ReadyState = 4 Wait(100) Loop

MaPageHtml = IE.Document 'A adapter en fonction du type d'objets à manipuler dans la page html Helem = MaPageHtml.getElementsByTagName("input")

'--- Adaptez le nom des objets contenus dans la page html --- 'remplissage champs Helem.Item("Profil").InnerText = "NomUtilisateur" Helem.Item("PassWord").InnerText = "MotDePasse"

'Déclenchement bouton de connection Helem.Item("NomBouton").Click '------------------------------------------------------------

End Sub

michel

Je souhaiterai récupérer des informations sur des pages web avec OOo basic. Cela fonctionne très bien avec l'exemple si dessous. Sub Main dim leP as integer dim monURL as string dim laR as string leP=InputBox("Quel N°?") monURL=ConvertToURL _ ("http://www.spip.net/fr_rubrique" & leP & ".html") Open monURL for input as #1 line input #1, laR MsgBox laR,0,"Reponse serveur" line input #1, laR MsgBox laR,0,"Reponse serveur" line input #1, laR MsgBox laR,0,"Reponse serveur" line input #1, laR MsgBox laR,0,"Reponse serveur" line input #1, laR MsgBox laR,0,"Reponse serveur" line input #1, laR MsgBox laR,0,"Reponse serveur" Close #1 End Sub

Cela se complique lorsque l'on souhaite accéder sur des pages à accès restreints. Y-a t-il un moyen quelconque d'accéder à des pages où l'authentification est gérée par des cookies, avec OOo Basic???