Get the image src and href data from posts

You can use preg_match_all to perform a regular expression match on the content of the post.

<div id='hitstatAdminMain'>
        <?php
        $args = array('post_type' => 'post', 'posts_per_page' => -1);
        $query = new WP_Query($args);

        if ($query->have_posts()) {
           while ($query->have_posts()){
              $query->the_post();
              // Store the current iterated posts content in a variable
              $content = get_the_content();
              // Perform a global regular expression match for content of `href` attribute
              preg_match_all('/<a[^>]+href=([\'"])(?<href>.+?)\1[^>]*>/i', $content, $hrefResult);
              // Perform a global regular expression match for content of `src` attribute
              preg_match_all('/<img[^>]+src=([\'"])(?<src>.+?)\1[^>]*>/i', $content, $srcResult);
              // preg_match_all returns an array so if you only have 1 image and 1 link you can get the first array index using `[0]`.
              $href = $hrefResult['href'][0];
              $src = $srcResult['src'][0];
           }
        }
        wp_reset_query();

        ?>
</div>