I want to take data from the site, but I get the following error: Could not connect to host

What is the problem ? How do I solve this problem? Please help me

Code is:

<?php
try {

ini_set("auto_detect_line_endings", true);
ini_set("soap.wsdl_cache_enabled", "0");

$opts = array(
'ssl' => array('ciphers'=>'RC4-SHA', 'verify_peer'=>false, 'verify_peer_name'=>false)
);
// SOAP 1.2 client
$params = array ('encoding' => 'UTF-8', 'verifypeer' => false, 'verifyhost' => false, 'soap_version' => SOAP_1_2, 'trace' => 1, 'exceptions' => 1, "connection_timeout" => 180, 'stream_context' => stream_context_create($opts) );
$client = new SoapClient ( "https://dbs.epdk.org.tr/EPDKPetrolWS/EPDKPetrol.asmx?WSDL", $params );

$paramsfunc = array( 'Tarih' => '01/01/2016');
$result = $client->PetrolPiyasasiEnYuksekHacimliSekizFirmaninAkaryakitFiyatlari($paramsfunc)->PetrolPiyasasiEnYuksekHacimliSekizFirmaninAkaryakitFiyatlariResult;

echo "hello";
echo "<pre>";
// Sonucu ekrana bas
var_dump($result);
echo "</pre>";

} catch (Exception $exc) { // Hata olusursa yakala
echo "Soap Hatasi Olustu: " . $exc->getMessage();
}

?>

    PS: In a recent task at work I actually extended the SoapClient class, then overrode the __doRequest() method, which as a side effect allowed me to output a bunch of the parameters to the PHP error log so I could debug some issues I was having.

      Thank you for your interest, but this did not solve my problem

        dalecosp;11054117 wrote:

        Debugging 101

        Thanks, but what to do with my problem? Trying to get data with php + soap, I get this error: Could not connect to host

          erenbey44;11054119 wrote:

          Thanks, but what to do with my problem? Trying to get data with php + soap, I get this error: Could not connect to host

          :rolleyes:

          <?php
          
          //if using browser, uncomment the below to format the data
          #echo "<pre>";
          
          //is host reachable?
          echo `print -t 1 dbs.epdk.org.tr`;
          
          //can we access the webserver?
          print_r(file_get_contents("https://dbs.epdk.org.tr/EPDKPetrolWS/EPDKPetrol.asmx?WSDL"));
          
          //does SOAP work elsewhere?
          $u="http://www.soapclient.com/xml/SQLDataSoap.WSDL";
          $client = new SoapClient($u);
          var_dump($client);
          
          //if using browser, uncomment the below to format the data
          #echo "</pre>";
          

            You might want to look at the WSDL if nothing else, and see what URL it's specifying, and if there are any comments about it, alternate URLs, etc.

              display output here:

              "PRN ayg&#65533;t&#65533; ba&#65533;lat&#65533;lamad&#65533; EPDK Petrol Piyasasi Web Hizmetleri <br><b>Verilen tarih için yay&#305;mlanm&#305;&#351; olan en yüksek i&#351;lem hacimli sekiz firman&#305;n ortalama bayi akaryak&#305;t fiyatlar&#305;n&#305; sorgulayan web hizmetidir. 01/01/2008'den sonra yay&#305;mlanan fiyatlar&#305; kapsar. Tarihi yyyy/aa/gg olarak giriniz.</b> <br><b>Petrol Piyasas&#305; trafik koduna göre akaryak&#305;t bayi fiyatlar&#305;n&#305; listeleyen web hizmetidir.</b> EPDK Petrol Piyasasi Web Hizmetleri

              object(SoapClient)[1]
              public '_soap_version' => int 1
              public 'sdl' => resource(7, Unknown)

              what should I do?

                OK; now replace $u with the actual URL of the resource you wish to use:

                $u = "https://dbs.epdk.org.tr/EPDKPetrolWS/EPDKPetrol.asmx?WSDL";
                $client = new SoapClient($u);
                var_dump($client);

                If I were a betting man, I'd wager a tad on character issues?

                  Write a Reply...