Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $string = file_get_contents("/home/devreclaim/davidsoninstalls.json");
- $installs = json_decode($string, true);
- $urls = array();
- echo '<ol>';
- foreach ($installs['data'] as $install){
- echo '<li>' . $install['url'] . ' ' . checkSite($install['url']) . '</li>';
- }
- echo '</ol>';
- function checkSite($url){
- $fullUrl = $url .'/wp-json';
- $response = wp_remote_get( $url, array( 'timeout' => 25 ) ); //change to php file_get_contents on non-wp
- if( ! is_wp_error( $response )
- && isset( $response['response']['code'] )
- && 200 === $response['response']['code'] )
- {
- $body = wp_remote_retrieve_body( $response );//RETURNING JSON API DATA *** change if non-wp
- $data = json_decode( $body, true );
- if(isset($data['ddm_tag'])){
- return 'true';
- } else{
- return 'false';
- }
- }
- }
Add Comment
Please, Sign In to add comment