Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chrisjdavis
Last active January 1, 2016 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisjdavis/8173078 to your computer and use it in GitHub Desktop.
Save chrisjdavis/8173078 to your computer and use it in GitHub Desktop.
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