我正在使用HTMLAgilityPack从以下网站获取HTML:http://tennis.wettpoint.com/en/
它工作正常,但现在......一小时后它就不再起作用了!
首先,我尝试更改我的代码 - 关于如何检索HTML:
string url = "http://tennis.wettpoint.com/en/";
HtmlWeb hw = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = hw.Load(url);
foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
{
//Code..
}
Run Code Online (Sandbox Code Playgroud)
就像我说的,这总是很好..直到该网站似乎"向下"为我..所以我将代码更改为:
using (WebClient wc = new WebClient())
{
wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows; Windows NT 5.1; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4");
string html = wc.DownloadString("http://en.wikipedia.org/wiki/United_States");
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
}
Run Code Online (Sandbox Code Playgroud)
(这对我的网站不起作用,但在其他网站上工作)
至少我现在有这个,这也有效,但不适用于我的网站:
HtmlAgilityPack.HtmlDocument doc = GetHTMLDocumentByURL(url);
public HtmlAgilityPack.HtmlDocument GetHTMLDocumentByURL(string url)
{
var htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.OptionReadEncoding = false;
var request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent …Run Code Online (Sandbox Code Playgroud) 我正在建立我的第一个网站.它是一个在线房地产代理商.用户可以创建个人资料,然后插入广告并上传图片.
我被告知我应该检测多次记录尝试以防止暴力攻击.好吧,使用以下代码我检测到IP:
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{ $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];} else
{ $ip=$_SERVER['REMOTE_ADDR'];}
Run Code Online (Sandbox Code Playgroud)
系统会在一定延迟内计算错过的记录尝试次数,并在数据库中保留禁止列表.它很棒......至少在我自己测试的时候!
然后,当我被告知"通过虚假IP提防盗版"时,我得到的印象是我上面提到的保护系统无效.
有 :
1)包含可以隐藏其真实IP的代理的pirat可用的软件
2)网络上的代理也可以隐藏真实的IP.
1)和2)有什么区别?
我想知道如何使用代理以及它们在非法行为方面能够做些什么
非常感谢.
我使用PHP函数file_get_contents作为代理来获取两个不同的Web主机上的网站.
它适用于除维基百科以外的所有网站.
它每次都给我这个输出:
WIKIMEDIA FOUNDATION
错误
我们的服务器目前遇到技术问题.这可能是暂时的,应尽快解决.请在几分钟后再试一次.
谁知道问题是什么?
我的代码中实现了很多类.现在我意识到,对于为所有这些类调用的每个方法,我需要添加一行:
with service as object:
Run Code Online (Sandbox Code Playgroud)
所以我试图使用代理模式自动完成工作,这是我的示例代码
class A(object):
def __init__(self, name):
self.name = name
def hello(self):
print 'hello %s!' % (self.name)
def __enter__(self):
print 'Enter the function'
def __exit__(self, exc_type, exc_value, traceback):
print 'Exit the function'
#
class Proxy(object):
def __init__(self, object_a):
# object.__setattr__(self, '_object_a', object_a)
self._object_a = object_a
def __getattribute__(self, name):
service = object.__getattribute__(self, '_object_a')
# with service as service:
result = getattr(service, name)
return result
if __name__=='__main__':
a1 = A('A1')
b = Proxy(a1)
b.hello()
a2 = A('A2')
b …Run Code Online (Sandbox Code Playgroud) 这是nginx的de配置文件
gzip on;
gzip_disable "msie6";
# gzip_static on;
gzip_min_length 1400;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 9;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css image/png image/gif image/jpg application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript applicacion/x-font-ttf font/opentype application/x;
Run Code Online (Sandbox Code Playgroud)
在谷歌分析器中出现js文件没有压缩,所以我添加到nodejs gzippo模块,这是回购
//app.use(express.static(path.join(__dirname, 'public')));
app.use(gzippo.staticGzip(path.join(__dirname, 'public')));
Run Code Online (Sandbox Code Playgroud)
当我添加模块谷歌说,js是gzipped,但在repo不说我怎么能添加CSS文件和图像文件到gzippo模块压缩
所以我怎么知道用nginx或nodejs gzippo模块压缩文件,我怎么能压缩otf文件?
我有2个项目,一个网站和一个代理库(DLL)
代理项目有..
public class Client
{
}
public class Proxy
{
public Client GetClient()
{
return new Client();
}
}
Run Code Online (Sandbox Code Playgroud)
如何阻止网站创建新的Client实例,但允许它创建Proxy实例,仍然运行GetClient?
我目前正在编写一个需要更改Windows代理设置的C#代理程序.每个在线指南仅更改LAN连接的代理设置(即NAT后面).这是一个问题,因为中国的许多用户(我的目标受众)直接将PPPoE连接从他们的调制解调器连接到他们的计算机并使用PPPoE软件拨号到DSL(是的,这是非常安全的,所有监听端口都可以看到世界,但事情就是这样).
我该如何更改DSL代理?这很令人担忧,因为查看我的用户统计信息~20%的人没有自动更改代理设置.
我试图通过使用此代码访问该URL
System.setProperty("http.proxyHost", "111.88.15.108");
System.setProperty("http.proxyPort", "8002");
System.setProperty("http.proxyUser", "user");
System.setProperty("http.proxyPassword", "password");
URL oracle = new URL("http://www.google.com/");
URLConnection yc = oracle.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
Run Code Online (Sandbox Code Playgroud)
这在我的窗口机器上工作正常,但这在linux机器上不起作用.我这样变得很恐怖
线程"main"中的异常java.io.IOException:服务器返回HTTP响应代码:407为URL:http://www.google.com/ at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)在com.yahoo.Connection.main(Connection.java:31)
即使代理设置是正确的,我也尝试过
java -Dhttp.proxyHost="111.88.15.108" -Dhttp.proxyPort="8002" -Dhttp.proxyUser="user" -Dhttp.proxyPassword="password" -jar yahoo_test3.jar
Run Code Online (Sandbox Code Playgroud)
但相同的错误,我试图在/ etc/profile中设置导出http_proxy =但没有用
知道哪里出错了.
我尝试使用Liferay-IDE 2.0创建新的Lifreay-Plugin项目.但我得到常春藤网络问题.我认为有必要为Ivy配置代理,但我不知道在哪里这样做.
这里的例外:
[Console output redirected to file:D:\Liferays\6.2.CE-RC5\workspace\.metadata\.plugins\com.liferay.ide.sdk.core\sdk.log]
Buildfile: D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\themes\build.xml
[get] Getting: http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar
[get] To: D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\.ivy\ivy-2.3.0.jar
[get] Error getting http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar to D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\.ivy\ivy-2.3.0.jar
BUILD FAILED
D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\themes\build.xml:5: The following error occurred while executing this line:
D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\build-common-plugins.xml:5: The following error occurred while executing this line:
D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\build-common.xml:47: The following error occurred while executing this line:
D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\build-common-ivy.xml:17: java.net.UnknownHostException: repo1.maven.org
Run Code Online (Sandbox Code Playgroud)
随着maven,行为很好.
我正在尝试使用路由器表创建一个NodeJS http代理.我看到一些使用http-proxy的例子并尝试这样:
var httpProxy = require('http-proxy');
var proxyTable = {};
proxyTable['testproxy.com/toto'] = 'google.com:80';
proxyTable['testproxy.com/tata'] = 'gmail.com:80';
var httpOptions = {
router: proxyTable
};
console.log('Proxy Server Listening on port 80');
console.log('Requests to textproxy.com/toto (on port 80) are redirected to google.com:80');
console.log('Requests to textproxy.com/tata (on port 80) are redirected to gmail.com:80');
httpProxy.createServer(httpOptions).listen(80);
Run Code Online (Sandbox Code Playgroud)
仅供参考:testproxy.com参考127.0.0.1.
它似乎工作(它只拦截testproxy.com/toto和tata的请求),但当我尝试:
curl http://testproxy.com/toto
Run Code Online (Sandbox Code Playgroud)
我有一个NodeJS错误:
var proxyReq = (options.target.protocol === 'https:' ? https : http).reque
^
TypeError: Cannot read property 'protocol' of undefined
at Array.stream [as 3] (D:\workspace\Proxy W_S\node_modules\http-proxy\l
ib\http-proxy\passes\web-incoming.js:103:35) …Run Code Online (Sandbox Code Playgroud)