Bonjour,
J'effectue des requêttes http avec l'objet MSXML2.serverXMLHTTP, j'ai un premier script qui test un site et ensuite appèle un second script qui appèle un second site, mais avec le second site, il y a une boucle qui modifie l'urlLe programme plante lors du objHttp.Send().
Code : Sélectionner tout - Visualiser dans une fenêtre à part ¶m1=0 to ¶m1=n
Script 1
script 2
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP") urlCert = "https://euhhyppq16:8443/migrate.php?gianni=1" xmlHttp.Open "GET", urlCert, False xmlHttp.Send "" getHTML = xmlHttp.responseText status = xmlHttp.status charge = xmlHttp.readyState 'if charge = 4 Then ' MsgBox("ok") 'End If xmlHttp.Abort Set xmlHttp = Nothing If status = 200 Then If Len(getHTML) > 0 Then 'MsgBox(charge) MsgBox(inStr(getHTML,"Data transfert ok")) If inStr(getHTML,"Data transfert ok") <> 0 then urlMigrateError = false Else MsgBox("Erreur page migrate.php") End if End If End If If urlMigrateError = false Then Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP") urlCert = "https://euhhyppq16:8443/GroupOrderManagementTool2/export/export.php" xmlHttp.Open "GET", urlCert, False xmlHttp.Send "" getHTML = xmlHttp.responseText status = xmlHttp.status xmlHttp.Abort Set xmlHttp = Nothing If status = 200 Then If Len(getHtml) > 0 Then If inStr(getHTML,"Data transfert ok") <> 0 Then MsgBox("ok pour second site") urlExportError = false End If End If End If End If If urlExportError = false Then Set WSHSell = CreateObject("WScript.Shell") WSHSell.run "wscript F:\Test\urlParticule.vbs" End If
Est-ce que quelqu'un a déjà vu ça? est-il possible de définir un timeout? Dans le forum j'ai vu qqun qui avait le même problème mais c'est des pages asp, qu'il utilisait et il utilisait la commande Server.Execute pour exécuter le code mais depuis l'asp.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 urlExportError = false If urlExportError = false Then Const ForReading = 1, ForWriting = 2 dim year, month, particule urlExport = "https://euhhyppq16:8443/GroupOrderManagementTool2/export/export.php?go=1&period=" Set oFso = CreateObject("Scripting.FileSystemObject") set f = oFso.OpenTextFile("C:\Test\test.sta", ForReading) myDate = f.ReadAll f.Close year = Left(myDate, 4) month = Right(myDate,2) Select Case year case 2010 'Select Case month ' case 06 particule = 13 + month MsgBox(particule) For i = 13 To particule checkUrlExport=createUrl(i) 'MsgBox(checkUrlExport) 'MsgBox(urlExport & i) Next 'case Else ' MsgBox("Erreur de mois") 'End Select case Else MsgBox("Erreur d'année") End Select Function createUrl(finUrl) Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP") urlCert = urlExport & finUrl MsgBox(urlCert) xmlHttp.Open "GET", urlCert, False xmlHttp.Send "" getHTML = xmlHttp.responseText status = xmlHttp.status charge = xmlHttp.readyState xmlHttp.Abort Set xmlHttp = Nothing If status = 200 Then If Len(getHtml) > 0 Then If inStr(getHTML,"Data transfert ok") <> 0 Then MsgBox("ok pour second site avec particule" & finUrl) urlExportError = false End If End If End If createUrl = urlExportError End Function End If
Partager