Created
November 11, 2013 17:29
-
-
Save bryanmonzon/7416962 to your computer and use it in GitHub Desktop.
String Replace Issue. Can you help me out with this?
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
<?php | |
/** | |
* Code block 1 | |
* This block doesn't work. Having "://" in there makes this not work at all. | |
*/ | |
$vimeo_id = 72170966; //Example ID. | |
$hash = unserialize(file_get_contents("https://vimeo.com/api/v2/video/$vimeo_id.php")); //Parses JSON to get Video info | |
$vimeo_thumb = $hash[0]['thumbnail_small']; //this ends up being http://secure-b.vimeocdn.com/ts/153/182/15318283_100.jpg | |
$vimeo_thumb = str_replace( "http://", "https://", $vimeo_thumb, $temp = 1); | |
echo $vimeo_thumb; //out puts http://secure-b.vimeocdn.com/ts/153/182/15318283_100.jpg | |
/** | |
* Code block 2 | |
* Removing the "://" adds two "s" to the output | |
*/ | |
$vimeo_id = 72170966; //Example ID. | |
$hash = unserialize(file_get_contents("https://vimeo.com/api/v2/video/$vimeo_id.php")); //Parses JSON to get Video info | |
$vimeo_thumb = $hash[0]['thumbnail_small']; //this ends up being http://secure-b.vimeocdn.com/ts/153/182/15318283_100.jpg | |
$vimeo_thumb = str_replace( "http", "http", $vimeo_thumb, $temp = 1); | |
echo $vimeo_thumb; //out puts httpss://secure-b.vimeocdn.com/ts/153/182/15318283_100.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. Didn't work though :/