wordpress 404 redirect to other url

If you are using wordpress as blog of your website blog and you are using other cms as your main website now you want any 404 of wordpress blog will redirect to that other cms 404 page then you use below code example to redirect your wordpress blog 404 page.

add_action('wp','determine_if_fourzerofour_page');
function determine_if_fourzerofour_page(&$arr){
    global $wp_query;    
    if($wp_query->is_404){        
        $url_redirect = 'http://www.exampledomain.com/404.php';        
        header('Location: '.$url_redirect);
        die;
    }
}

page scraping on php

if you are looking for page scraping help on php you can use below mentioned 2 function to fetch a web page then parse it as you wish. It’s using php curl extension and some string processing functions. Before start using it you need to enable the php_curl extension first then follow the below steps.

Getting a full webpage content:

< ?php
$pageUrl = 'http://maps.google.com';
$pageHtmlContent = getPage($pageUrl);
?>

Parsing a page html content:

< ?php
$subHtmlContent =  getValueByTagName($pageHtmlContent, '
', ''); ?>

Then you can now process the rest of content as you need. Above mentioned getPage and getValueByTagName functions are defined below you need to include them on you php page to use it.
Read More