Use get_posts() to get an array of images (from each post)

I’m trying to access each post’s attached images (even those without an attached image, I want a string if no images.).

I’ve got the following code, which is a foreach loop, and for every post it should post the title and attachment link.

However, it posts the same title twice (because there’s two posts in the database).

$args = array( );

$get_info = get_posts( $args );

foreach ( $get_info as $x ) {
echo the_title();
echo the_attachment_link();
}

Would anyone know why there’s not an attachment link and that it’s posting the same title, twice?

Pulling current post/page data into header.php

I want to pull some post/page specific data (author name, post ID, publish time, etc) into header.php to be used in meta tags. I am having trouble figuring out the most efficient way to do this. It is my understanding that I will need to create a loop within header.php to pull this data. How can I go about creating a loop for the current page/post if I don’t yet know the ID?