user-agent

Creating a proxy to spoof iPhone user-agent in PHP?

余生颓废 提交于 2019-11-29 04:54:49
I'm writing a web based iPhone simulator and I'm looking for a way to spoof iPhone's Safari browser so that web pages loaded within the simulator (iframe) to use the mobile versions. From my understanding I need to modify the user-agent. How do I go about creating a PHP proxy script to spoof the iPhone's user-agent? alex You could use a library like cURL to request the page with the iPhone user agent, and return that page to your site (be sure to expand relative URLs to absolute, with DOMDocument). However, you may run into edge cases where CSS/JavaScript/images are served differently via the

Scrapy using pool of random proxies to avoid being banned

拈花ヽ惹草 提交于 2019-11-29 04:16:06
问题 I am quite new to scrapy (and my background is not informatics). I have a website that I cant visit with my local ip, since I am banned, I can visit it using a VPN service on browser. To my spider be able to crawl it I set up a pool of proxies that I have found here http://proxylist.hidemyass.com/ . And with that my spider is able to crawl and scrape items but my doubt is if I have to change the proxy pool list everyday?? Sorry if my question is a dumb one... here my settings.py: BOT_NAME =

Is server-side user agent detection/sniffing bad?

社会主义新天地 提交于 2019-11-29 02:26:16
问题 Client-side user agent detection is known to be bad and discouraged in favor of feature detection. However, is it also bad to react differently based on the incoming user agent field in a HTTP request? An example would be sending smaller or larger images based on whether the incoming user agent is mobile or desktop. 回答1: I think it depends what your motivation is. For example, in the mobile web sector what you are attempting to do is provide the user with something that looks sensible on

Detect mobile user agent from classic ASP and redirect on session start

萝らか妹 提交于 2019-11-29 02:24:28
I'd like to detect a mobile user agent and redirect them when the session starts in a classic ASP app. Does anyone know a good way to pull this off? Take a look at: http://mobiforge.com/developing/story/lightweight-device-detection-asp sub is_mobile() Dim Regex, match Set Regex = New RegExp With Regex .Pattern = "(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|ipad)" .IgnoreCase = True .Global = True End With match = Regex.test(Request.ServerVariables("HTTP_USER_AGENT")) If match return True Else return False End If End Sub **Disclaimer:* the code may

How do I check Windows Phone useragent with javascript?

笑着哭i 提交于 2019-11-28 21:14:56
I can check for iPhone with this code: (navigator.userAgent.match(/iPhone/i)) But I want to target Windows Phone with this userAgent: Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1; Motorola_ES405B_19103; Windows Phone 6.5.3.5) Is there any way to do this? Windows Phone certainly seems to be the term you want to match. So just exchange iPhone in your matcher with that term and you're good to go! As mentioned in the comments: looking also for iemobile will give you an even broader range of detected microsoft mobiles OSes. e.g.: if(navigator.userAgent.match(/Windows Phone/i)){ alert('Is a

Ways to create a unique user fingerprint in PHP

别等时光非礼了梦想. 提交于 2019-11-28 19:18:06
What is the best way to generate a 'fingerprint' of user unique-ness in PHP? For example: I could use a user's IP address as the 'fingerprint', however, there could be multiple other users on the same IP I could use the user's IP + user agent as the 'fingerprint', however, a single user could simply swap from safari to firefox and again be seen as being unique Ideally, the fingerprint so label the 'machine' rather than browser or 'ip' but I can't think of how this is achievable. Open to ideas/suggestions of how you uniquely identify your users, and what advantages/disadvantages your method has

Retrieve User-Agent programmatically

一世执手 提交于 2019-11-28 18:37:11
Is there a way to retrieve Browser's user-agent without having a WebView in activity? I know it is possible to get it via WebView : WebView view = (WebView) findViewById(R.id.someview); String ua = view.getSettings().getUserAgentString() ; But in my case I don't have/need a webview object and I don't want to create it just for retrieving user-agent string. If you don't have one you can try taking it like this String ua=new WebView(this).getSettings().getUserAgentString(); Edit- The doc for getUserAgentString() says Return the WebView's user-agent string . So i don't think you can get it unless

How can I set the “User-Agent” header of a UIWebView in Swift

蹲街弑〆低调 提交于 2019-11-28 18:21:09
I am using Xcode 6 for an iOS App with Swift. I have got a simple ViewController with an embedded UIWebView. You can find the code below. Now I want to change the User-Agent HTTP header. I tried to use the setValue method of NSURLRequest but it didn't work (see uncommented line). Does anyone know how to do that? import UIKit class WebViewController: UIViewController { @IBOutlet weak var webView: UIWebView! override func viewDidAppear(animated: Bool) { var url = NSURL(string: "https://www.samplepage.com") var request = NSMutableURLRequest(URL: url) // request.setValue("Custom-Agent",

Pass the user-agent through webdriver in Selenium

∥☆過路亽.° 提交于 2019-11-28 18:02:52
I am working on a website scraping project using Selenium in Python. When I open the homepage through a browser, it opens properly. But, when I try to open the webpage through webdriver() in Selenium, it opens a completely different page. I think, it is able to detect the user-agent ( not sure what it is called) and is able to check the properties of the browser or something. Is it possible to pass the properties though the webdriver() so that the right homepage is loaded. Thanks Changing the user agent in the python version of webdriver is done by altering your browser's profile. I have only

How to set custom User-Agent with apache http client library 4.1?

一曲冷凌霜 提交于 2019-11-28 17:26:22
How to make HTTPClient use custom User-Agent header? The following code submits empty user-agent. What am I missing? import java.io.IOException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.CoreProtocolPNames; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import org.apache.http.util.EntityUtils;