I have a site thats connecting to a web service and I have a problem that I htink I know the answer too but I dont know how to work it in.
The web service isnt connecting, and I had this problem connecting before but that time it was using ajax, and the answer was to use jsonp.
So could someone have a look at the code below and integrate jsonp into it, as I believe its through the header but not sure how.
$hotelArray = array();
$query="select Id_Hot, Eml_Hot, Nom_Hot, IdCat_Hot, Dir_Hot, IdRsrt_Hot, IdCntry_Hot, TourCheckPublished, IdType_Hot, TourCheckActive, TourCheckCertified, TourCheckCertifiedPro, Foto1_Hot from tbl_hotels where TourCheckActive=1";
$resulta = $dbo->prepare($query);
$resulta->execute();
$num_rowsb = $resulta->rowCount();
if ($num_rowsb > 0){
$hotelArray = $resulta->fetchAll();
}
$cSession = curl_init();
$varID = 'anumberinhere';
curl_setopt($cSession,CURLOPT_URL,
"https://www.mysite.com/WebService.asmx/TC_GetPropertyData?id=".$varID."");
curl_setopt($cSession, CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_POST, false);
$result=curl_exec($cSession);
curl_error($cSession);
curl_close($cSession);
So the problem is exactly as it was before I integrated jsonp into the ajax connection, so thats why I think its the answer to this problem.
Why I have suddenly come across this, as after we transfered from the dev server to the live server, where it worked fine on the dev server with exactly the same code above, the only difference between the dev and live server is the path to the web service, the dev started with http: and the live https:
So this is why I’m guessing its a jsonp issue, but if there any other reason why it would connect fine with http: and then not with https: will be the answer to this