How to replace URL protocol using PHP?

I’m using HTTPS everywhere in my website but I have problems with sharing buttons for Pinterest and Tumblr. For example, when I try to share image on Pinterest I get this error: “Sorry we could not fetch the image.”

To make it work, I think I need to change image source URL protocols to HTTP only for my sharing buttons.

This is how I get thumbnail source:

$share_image_src = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );

I need to change this:

to this:

Solutions Collecting From Web of "How to replace URL protocol using PHP?"