PHP file_get_contents() returns “failed to open stream: HTTP request failed!”

Try using cURL. <?php $curl_handle=curl_init(); curl_setopt($curl_handle, CURLOPT_URL,’http://###.##.##.##/mp/get?mpsrc=http://mybucket.s3.amazonaws.com/11111.mpg&mpaction=convert format=flv’); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_USERAGENT, ‘Your application name’); $query = curl_exec($curl_handle); curl_close($curl_handle); ?>

How do I download a file using VBA (without Internet Explorer)

This solution is based from this website: http://social.msdn.microsoft.com/Forums/en-US/bd0ee306-7bb5-4ce4-8341-edd9475f84ad/excel-2007-use-vba-to-download-save-csv-from-url It is slightly modified to overwrite existing file and to pass along login credentials. Sub DownloadFile() Dim myURL As String myURL = “https://YourWebSite.com/?your_query_parameters” Dim WinHttpReq As Object Set WinHttpReq = CreateObject(“Microsoft.XMLHTTP”) WinHttpReq.Open “GET”, myURL, False, “username”, “password” WinHttpReq.send If WinHttpReq.Status = 200 Then Set oStream = CreateObject(“ADODB.Stream”) … Read more

How do I get currency exchange rates via an API such as Google Finance? [closed]

Thanks for all your answers. Free currencyconverterapi: Rates updated every 30 min API key is now required for the free server. A sample conversion URL is: http://free.currencyconverterapi.com/api/v5/convert?q=EUR_USD&compact=y For posterity here they are along with other possible answers: Yahoo finance API Discontinued 2017-11-06### Discontinued as of 2017-11-06 with message It has come to our attention that … Read more

The constructor JSONArray(Object[]) is undefined

That constructor is only available from API19: JSONArray(Object array) Therefore the most likely explanation is you are compiling against a lower API level. You can use the collection constructor though, by passing a list: JSONArray arrayObj = obj instanceof JSONArray ? (JSONArray) obj : new JSONArray(Arrays.asList(obj));