Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PHP for replacing http with https in dribbble image URLs
//create a stub to add our parsed shots to.
$str = '';
// here we assume you have already captured the API request content.
$shots = json_decode( $shots );
// next we iterate over the shots and find the URL we want to update.
foreach( $shots->shots as $shot ) {
$shot_url = str_replace( 'http', 'https', $shot->image_url );
$str .= '&lt;li>&lt;a href="' . $shot->url . '">&lt;img alt="' . $shot->title . '" src="' . $shot_url . '"></a></li>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment