Helloo, all I am trying to call the web service from file on windows server 2008.
I have connected to the server and installed there xampp and placed all the required files.
this is my code to call the webservice.
$result = file_get_contents("http://*******:8055/API.ashx?Method=Departure");
$json = json_decode($result, true);
$departure_count = count($json['Response']);
It gives me correct response on localhost but not on server. I have googled and they tell me that I should use cURL instead of file_gets_contents.
Then I used this code:
$url = 'http://*******:8055/API.ashx?Method=Departure';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
$json = json_decode($data, true);
$departure_count = count($json['Response']);
and it also gives me response on localhost but not on server, The address to access the URl is : http://221.120.222.68:8080/wordpress/fare/
When I tried to open $url in browser, it gives me the response