Example #1
0
function safe_scrape($url, $remove_line_breaks = false)
{
    $page = "";
    for ($i = 0; $i < 3; $i++) {
        if ($page == false) {
            if (SCRAPE_METHOD == "PEAR") {
                $page = scrape_page_pear($url);
            } else {
                $page = scrape_page_curl($url);
            }
        }
    }
    if ($remove_line_breaks) {
        $page = remove_line_breaks($page);
    }
    return $page;
}
function safe_scrape_page($url, $method = "GET")
{
    $page = "";
    for ($i = 0; $i < 3; $i++) {
        if ($page == false) {
            if (SCRAPE_METHOD == "PEAR") {
                $page = scrape_page_pear($url, $method);
            } else {
                $page = scrape_page_curl($url, $method);
            }
        }
    }
    return $page;
}