PHP CURL到VB.net的转换

PHP CURL到VB.net的转换,php,vb.net,curl,code-conversion,Php,Vb.net,Curl,Code Conversion,我有一个可以提取链接的php代码,但我的问题是我不知道如何将其转换为VB.net代码,因为VB.net不使用CURL。有什么方法可以转换这个吗?提前谢谢 我的代码: $npages=100; $gg_url = 'http://www.google.com/search?hl=en&q=' . urlencode(test) . '&filter=0&start='; $i=1; $size=0; $options = array( CURLOPT_RETURNTRAN

我有一个可以提取链接的php代码,但我的问题是我不知道如何将其转换为VB.net代码,因为VB.net不使用CURL。有什么方法可以转换这个吗?提前谢谢

我的代码:

$npages=100;
$gg_url = 'http://www.google.com/search?hl=en&q=' . urlencode(test) . '&filter=0&start=';
$i=1;
$size=0;

$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_COOKIEFILE => "cookie.txt",
CURLOPT_COOKIEJAR => "cookie.txt",
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
CURLOPT_REFERER => "http://www.google.com/",
);

    for ($page = $start; $page < $npages; $page++)
    {
        $ch = curl_init($gg_url.$page.'0');
        curl_setopt_array($ch,$options);
        $scraped="";
        $scraped.=curl_exec($ch);
        curl_close( $ch );
        $results = array();
        preg_match_all('/a href="([^"]+)" class=l.+?>.+?<\/a>/',$scraped,$results);
        foreach ($results[1] as $url)
        {
        echo "<a href='$url'>$url</a> <br>";
        $i++;
        }
        $size+=strlen($scraped);
    }

echo "Number of results: $i Total KB read: ".($size/1024.0);
$npages=100;
$gg_http://www.google.com/search?hl=en&q=' . urlencode(测试)。'&过滤器=0&开始=';
$i=1;
$size=0;
$options=array(
CURLOPT_RETURNTRANSFER=>true,//返回网页
CURLOPT_HEADER=>false,//不返回头
CURLOPT_FOLLOWLOCATION=>true,//跟随重定向
CURLOPT_ENCODING=>“”,//处理所有编码
CURLOPT_AUTOREFERER=>true,//在重定向时设置referer
CURLOPT_CONNECTTIMEOUT=>120,//连接超时
CURLOPT_TIMEOUT=>120,//响应超时
CURLOPT_MAXREDIRS=>10,//在10次重定向后停止
CURLOPT_COOKIEFILE=>“cookie.txt”,
CURLOPT_COOKIEJAR=>“cookie.txt”,
CURLOPT_USERAGENT=>“Mozilla/5.0(Windows;U;Windows NT 6.0;en-US;rv:1.9.0.3)Gecko/2008092417 Firefox/3.0.3”,
CURLOPT_REFERER=>”http://www.google.com/",
);
对于($page=$start;$page<$npages;$page++)
{
$ch=curl_init($gg_url.$page.0');
curl_setopt_数组($ch$options);
$scraped=“”;
$scraped.=curl_exec($ch);
卷曲关闭($ch);
$results=array();
preg_match_all('/a href=“([^”]+)”class=l.+?>.+?/,$scraped,$results);
foreach($results[1]作为$url)
{
回声“
”; $i++; } $size+=strlen($scraped); } echo“结果数:$i读取的总KB:”($size/1024.0);
使用
WebClient
对象。你应该能够对那个家伙做同样的事情: