Guest User

Untitled

a guest
Mar 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. $string = file_get_contents("/home/devreclaim/davidsoninstalls.json");
  2. $installs = json_decode($string, true);
  3. $urls = array();
  4.  
  5. echo '<ol>';
  6. foreach ($installs['data'] as $install){
  7. echo '<li>' . $install['url'] . ' ' . checkSite($install['url']) . '</li>';
  8. }
  9. echo '</ol>';
  10.  
  11. function checkSite($url){
  12. $fullUrl = $url .'/wp-json';
  13. $response = wp_remote_get( $url, array( 'timeout' => 25 ) ); //change to php file_get_contents on non-wp
  14.  
  15. if( ! is_wp_error( $response )
  16. && isset( $response['response']['code'] )
  17. && 200 === $response['response']['code'] )
  18. {
  19. $body = wp_remote_retrieve_body( $response );//RETURNING JSON API DATA *** change if non-wp
  20. $data = json_decode( $body, true );
  21. if(isset($data['ddm_tag'])){
  22. return 'true';
  23. } else{
  24. return 'false';
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment