How to retrieve my iPhone music?

I recently got a new laptop and completely forgot that not transferring the actual music files to my new laptop meant that they wouldn't be in the iTunes on my new laptop.

How can I get all the songs on my iPhone onto my computer, so that I can add them to my new iTunes?

If you plug your iphone into the computer I'm sure there a way to get the stuff off your phone onto the computer but don't sync with iTunes, I think it delete all your songs.