Last active
January 1, 2016 16:49
-
-
Save chrisjdavis/8173078 to your computer and use it in GitHub Desktop.
PHP for replacing http with https in dribbble image URLs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 .= '<li><a href="' . $shot->url . '"><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