Hello again Max,
I tried your corrected URL in the browser. The userid/pwd screen popped up 3 times: twice when I pasted the account key in password field so I finally manually typed it in and checked off to save credentials and obtained some query results. Unfortunately,
the same does not hold true programatically - I continue to get the following error:
Warning:
file_get_contents(https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27poland%27&Market=%27pl-PL%27&$top=15&$format=JSON)
[function.file-get-contents]: failed to
open stream: Connection refused in /home/cgerchma/public_html/test/getnewslinks.php on line
19
My code:
<?
error_reporting(E_ALL);
include "../php/phplogin.php3";
$ServiceRootURL = 'https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27poland%27&Market=%27pl-PL%27&$top=15&$format=JSON';
echo $ServiceRootURL;
$accountKey = 'MyPrimaryAccountKey';
$context = stream_context_create(array(
'http' => array(
'proxy' => 'tcp://127.0.0.1:8888',
'request_fulluri' => true,
'header' => "Authorization: Basic " . base64_encode($accountKey . ":" . $accountKey)
)
));
// line 19 below
$response = file_get_contents($ServiceRootURL,0,$context);
$jsonobj = json_decode($response);
//foreach($jsonobj->.....)
// never gets to this point
//}
?>
Once again if you could shed some light on this, I'd would greatly appreciate it .
Celine