Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/01/2006, 09:49
rrufo
 
Fecha de Ingreso: enero-2002
Mensajes: 1.438
Antigüedad: 22 años, 3 meses
Puntos: 0
un spider/robot como este pero en php

hace un tiempo hice este codigo en asp que hace un poco como un spider:

Código:
<%

Function GetHTML(strURL) 
Dim objXMLHTTP, strReturn, strHTML
Set objXMLHTTP = SErver.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.Open "GET", strURL, False
objXMLHTTP.setRequestHeader "Accept-Language", "sp"
objXMLHTTP.setRequestHeader "Pragma", "no-cache"
objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXMLHTTP.SetRequestHeader "Content-Type", "text/html"
objXMLHTTP.SetRequestHeader "charset", "iso-8859-1" 
objXMLHTTP.Send
if objXMLHTTP.statusText="OK" then
body8209 = objXMLHTTP.responseBody
GetHTML = ""
For i = 0 to UBound(body8209)
GetHTML = GetHTML & chrw(ascw(chr(ascb(midb(body8209,i+1,1)))))
Next 
else
Response.write "Error en página:" & objXMLHTTP.statustext
end if
Set objXMLHTTP = Nothing
End Function

 
  Function GetText(strText, strStartTag, strEndTag)
    dim intStart
    intStart = instr(1, strText, strStartTag, vbtextcompare)
    if intStart then
	  intStart = intStart + len(strStartTag)
	  intEnd = InStr(intStart + 1,strText,strEndTag,vbtextcompare)
	  GetText = CStr(Mid(strText,intStart,intEnd - intStart))
    else
	  GetText = " " 
    end if
  End Function
%>
y se se puede llamar con

Código:
MM_URL = "http://www.forosdelweb.com"
MM_URLHTML = GetHTML(MM_URL)
Response.write(GetText(MM_URLHTML,"<Title>","</Title>"))
de forma q te da el titulo de una web.

necesito lo mismo pero con php y me corre prisa, quien me da alguna pista?