3 * Send blog links to pingomatic.com to update.
5 * You can disable this feature by deleting the option 'use_linksupdate' or
6 * setting the option to false. If no links exist, then no links are sent.
8 * Snoopy is included, but is not used. Fsockopen() is used instead to send link
12 * @subpackage Administration
15 /** Load WordPress Bootstrap */
16 require_once('../wp-load.php');
18 if ( !get_option('use_linksupdate') )
19 wp_die(__('Feature disabled.'));
21 $link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");
24 wp_die(__('No links'));
26 $link_uris = urlencode( join( $link_uris, "\n" ) );
28 $query_string = "uris=$link_uris";
31 $options['timeout'] = 30;
32 $options['body'] = $query_string;
34 $options['headers'] = array(
35 'content-type' => 'application/x-www-form-urlencoded; charset='.get_option('blog_charset'),
36 'content-length' => strlen( $query_string ),
39 $response = wp_remote_get('http://api.pingomatic.com/updated-batch/', $options);
41 if ( is_wp_error( $response ) )
42 wp_die(__('Request Failed.'));
44 if ( $response['response']['code'] != 200 )
45 wp_die(__('Request Failed.'));
47 $body = str_replace(array("\r\n", "\r"), "\n", $response['body']);
48 $returns = explode("\n", $body);
50 foreach ($returns as $return) {
51 $time = substr($return, 0, 19);
52 $uri = preg_replace('/(.*?) | (.*?)/', '$2', $return);
53 $wdpdb->update( $wpdb->links, array('link_updated' => $time), array('link_url' => $uri) );