Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
User Agent to get source code
Hi,
I found this code on this group forum. but I have problem, I just do not want to pull source code. I want to pull source code by setting User Agent. Is there a way to get source code by changing User Agent to like iPhone or iPad? Thanks Sub Tester() Range("B2").Value = GetSource("http://www.google.com") End Sub Function GetSource(sURL As String) As String Dim oXHTTP As Object Set oXHTTP = CreateObject("MSXML2.XMLHTTP") oXHTTP.Open "GET", sURL, False oXHTTP.send GetSource = oXHTTP.responsetext Set oXHTTP = Nothing End Function |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
User Agent to get source code
Zuber Vohra wrote:
Hi, I found this code on this group forum. but I have problem, I just do not want to pull source code. I want to pull source code by setting User Agent. Is there a way to get source code by changing User Agent to like iPhone or iPad? [snip] Function GetSource(sURL As String) As String Dim oXHTTP As Object Set oXHTTP = CreateObject("MSXML2.XMLHTTP") oXHTTP.Open "GET", sURL, False oXHTTP.send GetSource = oXHTTP.responsetext Set oXHTTP = Nothing End Function You set the agent like this (before you open the connection): oXHTTP.setRequestHeader("User-Agent", "[whatever]") As for the specific strings to send, Google sez (watch the wordwrap)... - iPhone 4: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7 - iPhone 3: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16 - some older iPhone (possibly the original?): Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C25 Safari/419.3 - iPad: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 More googling will almost certainly reveal more useragent strings, but this should be (at the very least) a good start. -- Mad Science Minion |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Retreive data for same agent | Excel Worksheet Functions | |||
How do I obtain Microsoft Agent 2.0 or later? | Excel Discussion (Misc queries) | |||
prompt user to change source of links | Excel Discussion (Misc queries) | |||
VB Code Source | Excel Programming | |||
user form to copy and paste from source to destination | Excel Programming |