【问题标题】:Downloading data from another site从另一个站点下载数据
【发布时间】:2021-04-10 16:54:00
【问题描述】:

我想要来自https://ucp.paradise-rpg.pl/group/684 的数据以获得此数据:

SCREENSHOOT

然后将它们显示在我的网站上,但我什至不知道从哪里开始。如果有人可以帮助我,我将不胜感激

【问题讨论】:

标签: scrape


【解决方案1】:

想从https://ucp.paradise-rpg.pl/group/684下载数据 我能够在 CURL ` 中制作这样的代码

$lurl=get_fcontent("https://ucp.paradise-rpg.pl/"); print_r($lurl[0]);

函数 get_fcontent($url, $javascript_loop = 0, $timeout = 5) { $url = str_replace("&", "&", urldecode(trim($url)));

$cookie = tempnam ("/tmp", "CURLCOOKIE");
$ch = curl_init();
curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla / 5.0 (Windows NT 5.1; rv: 31.0) Gecko / 20100101 Firefox / 31.0");
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_ENCODING, "" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );    # required for https urls
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
$content = curl_exec( $ch );
$response = curl_getinfo( $ch );
curl_close ( $ch );

if ($response['http_code'] == 301 || $response['http_code'] == 302) {
    ini_set("user_agent", "Mozilla / 5.0 (Windows NT 5.1; rv: 31.0) Gecko / 20100101 Firefox / 31.0");

    if ( $headers = get_headers($response['url']) ) {
        foreach( $headers as $value ) {
            if ( substr( strtolower($value), 0, 9 ) == "location:" )
                return get_url( trim( substr( $value, 9, strlen($value) ) ) );
        }
    }
}

if (    ( preg_match("/>[[:space:]]+window\.location\.replace\('(.*)'\)/i", $content, $value) || preg_match("/>[[:space:]]+window\.location\=\"(.*)\"/i", $content, $value) ) && $javascript_loop < 5) {
    return get_url( $value[1], $javascript_loop+1 );
} else {
    return array( $content, $response );
}

}

?>`, it works correctly on other websites and on https://ucp.paradise-rpg.pl/group/684 such an error pops up from cloudflare, what should I do?

ERROR SS

【讨论】:

    【解决方案2】:

    除了下载之外,您可以只查找 API。我想在这里使用 API 将是最好的选择

    【讨论】:

    • 本站没有api
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 2014-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-18
    相关资源
    最近更新 更多