w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Can we spoof $_SERVER['REMOTE_ADDR'] / user ip with php cURL?
No. $_SERVER['REMOTE_ADDR'] is the actual physical IP address the client used to connect to the webserver, as confirmed by a three-way TCP handshake. There's no way to fake this by setting simple HTTP headers. You also cannot make the webserver/PHP overwrite this value with something else in any way. $_SERVER['REMOTE_ADDR'] is set from TCP connection information, period. To actually spoof an IP address, you have to go much deeper into the actual network layer and have some level of control over network equipment/man in the middle positions/proxies/whatnot to actually be able to establish a TCP connection from an IP address other than the one you're establishing it from. Is there a way for countering the method OR Is there a way to get the ACTUAL REAL IP of a user? No. "The actual IP

Categories : PHP

How to assign to workers a proxy that requires user name - password and a custom user agent?
Assign User Agent by Desired Capabilities dcap = dict(DesiredCapabilities.PHANTOMJS) dcap["phantomjs.page.settings.userAgent"] = ( "Your User Agent String here . . .") Found API Reference here for the proxy authorization. Add "--proxy-auth=username:password" to server_args. Like . . . service_args = [ '--proxy=xxx.xxx.xx.xxx:xxxx', '--proxy-auth=username:password', '--proxy-type=http', ] Then use both when starting the webdriver driver = webdriver.PhantomJS(desired_capabilities=dcap,service_args=service_args) This took care of all my issues. EDIT: Unable to reproduce solution. Only proxy is changed with above method. EDIT.02: Issue resolved. It was never a coding issue. A new proxy provider at the server level assigned a default UA that ov

Categories : Python

User login session variable. Is it possible to spoof session variable? PHP
What I would suggest would be to use something less obvious, as if your variable was a password (e.g. $_SESSION['logged1_in5']) because a hacker would then be less able to create a variable because they wouldn't know the name. And yes, a hacker (or anyone) could create a variable by creating their own page that creates the variable then executing it.

Categories : PHP

How do I set the user agent in Volley?
You should override the method getHeaders() in Request and set the "User-agent" header In your Request class: @Override public Map<String, String> getHeaders(){ Map<String, String> headers = new HashMap<String, String>(); headers.put("User-agent", "YOUR_USER_AGENT"); return headers; }

Categories : Android

Is it possible to specify user agent with URL in HTML?
Can the HTML DOM be modified to indicate that either a single or all URLs (<a href=""> elements) use a specific user agent? Not in any standard way. If it's possible to add a custom (non-standard) attribute to the element or possibly a child element to it, that'd work too, if it's valid to do so. "non-standard" is practically invalid by definition. There is a loophole in data- attributes (since they are defined by the specification as a way to add extensions) but: "These attributes are not intended for use by software that is independent of the site that uses the attributes" HTML 5 is a Candidate Recommendation, not a standard.

Categories : HTML

What is MATM in my User-agent
MATM is a codename for the hardware, one of several by the same vendor: useragent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; MATMJS) vendor: TS - useragent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; MATM) vendor: TS - useragent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; MATP) vendor: TS - useragent: Mozilla/5.0 (MSIE 9.0; Windows NT 6.3; WOW64; Trident/7.0; MATBJS; rv:11.0) like Gecko vendor: TS - useragent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; MATPJS; rv:11.0) like Gecko vendor: TS - useragent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; TNJB; rv:11.0) like Gecko vendor: TS - useragent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; Touch; TAJB; rv:11.0) like

Categories : Internet Explorer

Interesting IOS 6 user agent
Ok basically if you install the Google Search App and visit a site via the app then the user agent will be Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_4 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B350 Hope this helps someone.

Categories : IOS

What is my user.agent version?
For Firefox (Gecko) use <set-property name="user.agent" value="gecko1_8" /> But it depends of the GWT version. Other possible values are ie6, ie8, gecko1_8, safari, opera, ie9.

Categories : Gwt

Can't change user agent php curl
curl_setopt($ch, CURLOPT_HTTPHEADER, array("User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3")); This worked for me and was necessary to post to NodeJs server since PHP's cURL did not by default provide one.

Categories : PHP

Change User-Agent of audio tag
I don't think there's a way to change the User-Agent. But you can force SHOUTcast to serve the stream by adding a Semicolon ; to the end of the URL. SHOUTcast will then ignore the User-Agent. HTML5 example: <!DOCTYPE html> <html> <body> <audio controls> <source src="http://72.13.82.82:5100/;"/> <em>Sorry, your browser doesn't support HTML5 audio.</em> </audio> </body> </html> You can also verify the workaround by visiting http://72.13.82.82:5100/; directly in browser. You should see some ICY-metadata followed by the mpeg stream.

Categories : Javascript

IE8 reporting its user agent string as IE9
We had a customer with the same issue. Also stumped. We changed to using TRIDENT as well as the MSIE number to accurately detect what they were using. If they are using Trident 4, it is either IE 8 (or IE 7 because of compat mode) but nothing higher. Same for other versions of IE as well. Trident 5 can't be higher than IE 9, etc.

Categories : Internet Explorer

Setting User Agent of URLClassLoader
Try using this constructor: URLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) By overriding some stuff in the factory, you should be able to set the user agent before it establishes a URL connection.

Categories : Java

What is 'AskTbPTV' in HTTP User Agent?
Ask.com toolbar http://apnstatic.ask.com/static/toolbar/everest/download/index.html?source=sp wich modify user agent string.

Categories : Misc

what is the user agent string (github api)
You need to pass a user agent string like it says :) I just pulled one from chrome: require( 'https' ) .get({ hostname : 'api.github.com' , path :'/repos/cwolves/jquery-imask/issues' , headers : { 'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36' } }, function(res){ res.on('data',function(data){ console.log(data+''); }); });

Categories : Javascript

What user.agent property value should i use in gwt.xml for FF21?
There is only one firefox user agent and is gecko1_8. It targets the gecko engine 1.8 and onwards, hence FF >= 1.5 according to this. Have a look at here to find all the available user agents you can use.

Categories : Gwt

how to change user agent in selenium with .net
In c#: public static FirefoxProfile myFireProfile = new FirefoxProfile(); myFireProfile.SetPreference("general.useragent.override", "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"); public IWebDriver driver= new FirefoxDriver(myFireProfile);

Categories : Dotnet

How can I divide users by their user-agent?
Yu should have a look at https://github.com/brendanlim/mobile-fu. It should help you to accomplish things like this. It also enables you to check in your templates for mobile devices.

Categories : Javascript

H3 being overwritten by user agent stylesheet but only for em
h1 { font-size: 3.929 em } h2 { font-size: 2.072 em; text-transform: uppercase; } h3 { font-size: 2.072 em; padding: 10px 0;} take away the spaces between the number and the 'em' h1 { font-size: 3.929em } h2 { font-size: 2.072em; text-transform: uppercase; } h3 { font-size: 2.072em; padding: 10px 0;}

Categories : Misc

IE 11 sends different User-Agent header to different subdomains
Microsoft has the site in question configured to use UA-spoofing (via the Compatibility View list) and that causes IE to send a custom UA string. CompatView-based UA spoofing was enabled in IE8 in 2008: http://blogs.msdn.com/b/ie/archive/2008/08/27/introducing-compatibility-view.aspx And in IE10+, it's gotten richer, with per-site spoofing to enable the best experience. See http://blogs.msdn.com/b/ieinternals/archive/2013/09/21/internet-explorer-11-user-agent-string-ua-string-sniffing-compatibility-with-gecko-webkit.aspx for an exploration of this topic.

Categories : Internet Explorer

Is is possible to specify (fake) a User Agent using IIS Reverse Proxy?
The solution was simple enough. In IIS in the URL Rewrite configuration slick View Server Variables... in the right hand column. Click add and enter the name of the Server Variable - in this case HTTP_USER_AGENT. This will allow you to use and/or modify this specific server variable during the routing process. This is the step that I had missed, or gotten wrong before. To my knowledge this can't be done in the web.config file. I'm sure there's a command line to do it, but I don't know that. After adding HTTP_USER_AGENT to the allowed server variables list it is just a matter of setting that either through IIS or in the Web.config file add the desired value to the server variables section. <rule name="..." enabled="true" stopProcessing="true"> <match url="[pattern]" />

Categories : Dotnet

Which browser have this strange user agent? (IOS device)
The shorter user agent comes when an ipad enters "web app" mode. This means that a phone is parsing the html only using webkit, in full screen mode, not within a safari browser window. Thus only the information about CPU version, webkit version, etc is sent along. http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html Additional discussion can be found on this very similar post: ipad user agent changes during use?

Categories : IOS

Using user-agent language with Django Translation
I would go for user agent because the user is able to set his preferred language in his browser. IP location says nothing about the language the user actually speaks nor does the user have any influence on it. In both cases you can still provide a language selector on your page as well.

Categories : Django

Change User Agent in IE7 through javascript/html
No, you cannot change the UA String of the browser from script. You can do it with an extension or the registry. But the premise of your question is wrong-- if you change the UA string to "trick" the application, you may avoid the "You need to upgrade your browser" error message and instead you'll just have broken pages that are throwing exceptions or laying out incorrectly because they depend on IE8+ features that aren't present in IE7. IE7 is crusty, insecure, and shouldn't be used any longer.

Categories : Javascript

how to set user agent in rspec route assertions
I'm not sure this will work, but here's something to try: If you look at the source for the RouteToMatcher, it just parses a controller/action pair (given as a hash or in controller#action format) and any other parameters given along with them and then delegates to ActionDispatch::Assertions::RoutingAssertions#assert_recognizes. But that method builds the request object from the parameters you pass in as the argument to route_to. So there's no easy way to access the request object from your spec. However, to build this dummy request, it calls ActionController::TestRequest.new So you might try ActionController::TestRequest.any_instance.stub(:user_agent). and_return "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329

Categories : Ruby On Rails

Load different .css basing on user-agent - GWT project
I am using mgwt for creating mobile gwt apps. There is a themeing based on user agent: https://code.google.com/p/mgwt/source/browse/src/main/java/com/googlecode/mgwt/ui/client/theme/MGWTThemeBaseThemeStandardImpl.java In your Bundle you can seperate different css. If you don't use CssResources you may just use the StyleInjector

Categories : CSS

mobile user agent detection with htaccess
You don't want to redirect to /getapp if you're already there. Try excluding that URI: RewriteCond %{HTTP_USER_AGENT} "android|ipad|iphone|ipod" [NC] RewriteRule !^getapp http://www.example.com/getapp [L,R=302] To allow an optout after a user visits the getapp page, you'll need to persist a cookie or something: RewriteCond %{HTTP_USER_AGENT} "android|ipad|iphone|ipod" [NC] RewriteCond %{HTTP_COOKIE} !app-optout RewriteRule !^getapp http://www.example.com/getapp [L,R=302] RewriteCond %{HTTP_USER_AGENT} "android|ipad|iphone|ipod" [NC] RewriteRule ^getapp - [CO=app-optout:1:www.example.com] So here, you only redirect to /getapp if there is no "app-optout" cookie. Once there, you set the opt out so that they don't get redirected there again if they navigate out of the getapp page.

Categories : Android

Regex to parse a user agent string
This regex will capture it: (?<=().*?;.*?;.*?(?=;) As code it would be: string s = Regex.Match(input, @"(?<=().*?;.*?;.*?(?=;)").Value As breakdown of the regex: (?<=() = a "look behind" that asserts the previous char is a literal open bracket ( .*?; = a (non-greedy - won't skip ;) match of everything up to the next ; (?=;) = a "look ahead" that asserts the next char is a literal semi-colon ;

Categories : C#

Unable to change the user-agent in Silverlight C#. how I can do it?
According to the documentation for the Silverlight WebHeaderCollection user-agent is listed as a restricted field that you cannot change, so it appears that there is no way to change it. Some common headers are considered restricted and are either exposed directly (such as Content-Type) or protected by the system and cannot be set or changed in a WebHeaderCollection object. Any attempt to set one of these restricted headers in the WebHeaderCollection object associated with a HttpWebRequest object throws an exception. Any attempt to set one of these restricted headers in the WebHeaderCollection object associated with a WebClient object will throw an exception later when attempting to send the WebClient request. Many of these restricted headers are set by the web bro

Categories : C#

Extract bot name from user-agent string-Python
Try following: import re lines = [ 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', 'Mozilla/5.0 (compatible; AhrefsBot/4.0; +http://ahrefs.com/robot/)', 'msnbot/2.0b (+http://search.msn.com/msnbot.htm)' ] botname = re.compile('w+bot/[.w]+', flags=re.IGNORECASE) for line in lines: matched = botname.search(line) if matched: print(matched.group()) prints Googlebot/2.1 AhrefsBot/4.0 msnbot/2.0b assumed that bot agent names contain bot/.

Categories : Python

Checking user agent in cookies, minor changes
I'm just gonna throw this out here. User-Agents are a bad security measure. But there's not a lot of other alternatives. So! To get the user agent string... $_SERVER['HTTP_USER_AGENT']; Now if your encrypting and setting it to cookies, and worried by small changes (which should only happen if the browser changes or gets updated). I would suggest stripping this info down and using basic info like OS, Hardware, and Browser Brand. There are PHP libraries available to help facilitate the parsing of these strings. You can also salt this with the users IP address if your really worried. You can get the IP with... $_SERVER['REMOTE_ADDR']; But remember, both of these values can be faked EASILY and are not to be trusted.

Categories : PHP

Allow only one User-Agent, block the rest in nginx?
You can try the following in the proper location set $isallowed = ""; if ($http_user_agent = allowed_user_agent) { set $isallowed "${isallowed}YES"; } if ($isallowed !~ YES) { rewrite ^ http://yourserver.com permanent; }

Categories : Nginx

chrome : how to turn off user agent stylesheet settings?
https://developers.google.com/chrome-developer-tools/docs/settings Open Chrome dev tools > click gear icon on bottom right > In General section > check or uncheck "Show user agent styles.

Categories : CSS

Iphone app browser window - Add value to user agent string
Can't you pass those values as GET params in the url? For android: http://www.somedomain.com/page.html?appName=myAndroidApp&ver=version For ios: http://www.somedomain.com/page.html?appName=myIphoneApp&ver=version

Categories : Android

PHP Server User Agent to determine browser and CSS support
Yes, but I wouldn't recommend doing it yourself. That user agent string is notoriously fickle. Some browsers send it one way, other versions of the same browser send it another. It's a mess to try to keep track of yourself. I would recommend going with a library that can do this for you. Here's one from the CodeIgniter framework I use: http://ellislab.com/codeigniter/user-guide/libraries/user_agent.html There are probably many, many others. This is a pretty commonly-done thing, so there's lots of solutions for it already.

Categories : PHP

Python: User-agent information urllib retrieve()
i dont think you can add custom headers while using urllib but i know there are multiple ways to do it using urllib2 one way you could is like this: import urllib2 headers = { 'User-Agent' : 'Mozilla/5.0' } req = urllib2.Request('http://example.com/image.jpg', None, headers) html = urllib2.urlopen(req).read() with open('download.jpg','r+') as f: f.write(html) this will download the image but the 'download.jpg' has to already exist there are more ways to do it i would take a look at this Setting the User-Agent also take a look at this Question Good Luck!

Categories : Misc

Smarty PHP, AbanteCart E-Commerce User Agent Theme
i guess the easiest way is hook of all controllers and adding new variable into request (sf) which contains template_text_id... plus using cookie about template mode(desktop or mobile). /** * redirect to mobile template if we load page in mobile device **/ public function onAHook_InitEnd() { if ( $this->_processHooks() ) return; $device = $this->baseObject->request->getDeviceType(); if ( !empty($device) && empty( $this->baseObject->request->cookie['abantecart_mobile_redirect'] ) ) { //set flag that redirect was done setcookie("abantecart_mobile_redirect", "1", time() + 3600*24); //set template to mobile $url = $this->baseObject->html->removeQueryVar($_SERVER['REQUEST_URI'], 'sf'); $url .= '&sf

Categories : PHP

User agent access to site Python in Linux
Here's an example Chrome user agent for Linux: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/507.12 (KHTML, like Gecko) Chrome/25.31.00.00 Safari/507.12 And a Firefox user agent on Ubuntu: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20100001 Here's a command line browser's user agent on Linux. Lynx/2.8.8dev.3 libwww-FM/2.14 SSL-MM/1.4.1 They're really not that strict. The safest user agent (from a success perspective) to use is Chrome or Firefox, but make sure to observe the robots.txt file.

Categories : Python

Is it Possible to define an alternative get_absolute_url for mobile user agent?
Yes, you can overload the get_absolute_url of the model by defining it in your model. It takes no arguments, but since is a python function, you can test if the user is using a mobile app to enter in your website and render the template accordingly. See it in Django documentation. By the way, it is very normal to change the get_absolute_url() function, for instance if you have a view specific for that model, one option is the get_absolute_url() returns the reverse of that view. Hope this helps.

Categories : Django

Sites not accepting wget user agent header
It seems that Yahoo server does some heuristic based on User-Agent. Accept: text/html did the trick for me. e.g. wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" http://yahoo.com Note: if you don't declare Accept header then wget automatically adds Accept:*/* which means give me anything you have.

Categories : Http

Detecting GWT permutation on server based on user agent
You can take advantage of the HTML5Manifest solution provided with mgwt. They have a linker which produces a file which can be read by the servlet they provide, and return the appropriate list of files to cache by the browser based on the user-agent header. If you want to do it by yourself, you can figure out the most suitable permutation per browser, based on the http user-agent header, and on the compilation-mappings.txt file which is generated by the gwt compiler if you are using xsiframe linker.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.