All,
I have the following code:
$context = stream_context_create(array(
'http' => array(
'timeout' => 5 // Timeout in seconds
)
));
$username = $options['account'];
$contents = file_get_contents( "https://api.twitter.com/1/statuses/user_timeline.json?screen_name={$username}&count=1", 0, $context );
When I execute this code it works fine. However when I change the contents to this:
$how_many = $options['how_many'];
$contents = file_get_contents( "
https://api.twitter.com/1/statuses/user_timeline.json?screen_name={$username}&count={$how_many}", 0, $context );
I get the following error:
Warning: file_get_contents(https://api.twitter.com/1/statuses/user_timeline.json?screen_name=Username&count=10) [function.file-get-contents]: failed to open stream: No error
Any ideas why it would work for one and not for the other. If I copy and paste that URL into a browser results are returned as well.
I ended up using cURL to get all of the values and it worked.