Obtener codigo fuente
Como puedo hacer desde asp obtener el codigo fuente de una web.
Estoy utilizando el objeto CreateObject("Msxml2.XMLHTTP") con sus metodos open y send pero tengo problemas con palabras con tildes y con la letra ñ ejem:
Título == T?lo
Señor == Se?
Un saludo
Estoy utilizando el objeto CreateObject("Msxml2.XMLHTTP") con sus metodos open y send pero tengo problemas con palabras con tildes y con la letra ñ ejem:
Título == T?lo
Señor == Se?
Un saludo
Tienes que hacer un urlencode del texto que tienes que enviar.
Te adjunto una funcion que hace el urlencode
Private Function URLEncode(str As String) As String
Dim strTemp, strChar As String
strTemp = ""
strChar = ""
Dim nTemp, nAsciiVal As Integer
For nTemp = 1 To Len(str)
nAsciiVal = Asc(Mid(str, nTemp, 1))
If ((nAsciiVal < 123) And (nAsciiVal > 96)) Then
strTemp = strTemp & Chr(nAsciiVal)
ElseIf ((nAsciiVal < 91) And (nAsciiVal > 64)) Then
strTemp = strTemp & Chr(nAsciiVal)
ElseIf ((nAsciiVal < 58) And (nAsciiVal > 47)) Then
strTemp = strTemp & Chr(nAsciiVal)
Else
strChar = Trim(Hex(nAsciiVal))
If nAsciiVal < 16 Then
strTemp = strTemp & "%0" & strChar
Else
strTemp = strTemp & "%" & strChar
End If
End If
Next
URLEncode = strTemp
End Function
Te adjunto una funcion que hace el urlencode
Private Function URLEncode(str As String) As String
Dim strTemp, strChar As String
strTemp = ""
strChar = ""
Dim nTemp, nAsciiVal As Integer
For nTemp = 1 To Len(str)
nAsciiVal = Asc(Mid(str, nTemp, 1))
If ((nAsciiVal < 123) And (nAsciiVal > 96)) Then
strTemp = strTemp & Chr(nAsciiVal)
ElseIf ((nAsciiVal < 91) And (nAsciiVal > 64)) Then
strTemp = strTemp & Chr(nAsciiVal)
ElseIf ((nAsciiVal < 58) And (nAsciiVal > 47)) Then
strTemp = strTemp & Chr(nAsciiVal)
Else
strChar = Trim(Hex(nAsciiVal))
If nAsciiVal < 16 Then
strTemp = strTemp & "%0" & strChar
Else
strTemp = strTemp & "%" & strChar
End If
End If
Next
URLEncode = strTemp
End Function