• 26-01-2020, 21:19:50
    #1
    Merhaba arkadaşlar,
    Şu sitenin içeriğini curl veya file_get_contents fonksiyonu ile bir türlü çektiremiyorum.
    Denemediğim yöntem kalmadı, hem localde deniyorum hemde hostingde şu hatayı alıyorum

    file_get_content fonksiyonu ile failed to open stream: HTTP request failed! hatası alıyorum
    curl ile denemelerde ya boş dönüyor yada Failed to enable crypto in
    SSL operation failed with code 1. OpenSSL Error messages:
    hataları alıyorum.
    ( Kullanıcıya tanımlı özel xml linki mevcut o yüzden o linki veremiyorum, siteden içerik çalma durumu yoktur)
    Yardımcı olan olursa sevinirim teşekkürler
    [B]Warning[/B]: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in xxx on line [B]14[/B]
    
    [B]Warning[/B]: file_get_contents(): Failed to enable crypto in xxx  on line [B]14[/B]
    
    [B]Warning[/B]: file_get_contents(https://www.siteadi.com): failed to open stream: operation failed in xxx on line [B]14[/B]
  • 26-01-2020, 21:30:46
    #2
    function getSSLPage($url) {    $ch = curl_init();    curl_setopt($ch, CURLOPT_HEADER, false);    curl_setopt($ch, CURLOPT_URL, $url);    curl_setopt($ch, CURLOPT_SSLVERSION,3);     $result = curl_exec($ch);    curl_close($ch);    return $result;}var_dump(getSSLPage("siteismi"));
  • 26-01-2020, 21:36:24
    #3
    onurkendir adlı üyeden alıntı: mesajı görüntüle
    function getSSLPage($url) {    $ch = curl_init();    curl_setopt($ch, CURLOPT_HEADER, false);    curl_setopt($ch, CURLOPT_URL, $url);    curl_setopt($ch, CURLOPT_SSLVERSION,3);     $result = curl_exec($ch);    curl_close($ch);    return $result;}var_dump(getSSLPage("siteismi"));
    Hocam sonuç vermiyor, siz localhostda deneyip sonuç aldınız mı?
  • 26-01-2020, 21:45:47
    #4
    Karşı tarafın kullandığı ssl sürümleri ile ilgili olabilir.
    Belki sizin bir ssl protokolü tanımlamanız gerekiyordur.
    Alakalı bir konu:
    https://www.venditan.com/blog/2015/0...oing-it-wrong/
  • 26-01-2020, 22:58:22
    #5
    Bununla ilgili birşeyler denedim ama olmadi maalesef
  • 26-01-2020, 23:26:07
    #6
    CULROPT_SSLVERİFYPEER TRUE bunu yapın hocam
  • 27-01-2020, 06:36:37
    #7
    asanprogrammer adlı üyeden alıntı: mesajı görüntüle
    CULROPT_SSLVERİFYPEER TRUE bunu yapın hocam
    Curl ile çektirirken denedim maalesef sonuç alamadim
  • 27-01-2020, 11:26:28
    #8
    <?php
    function curlFunction($url)
    {
    $ch = curl_init ();
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    
    $response = curl_exec($ch);
    curl_close($ch);
    
    return $response;
    }
    
    $url = "https://www.gokmenoyuncak.com/";
    $data = curlFunction($url);
    
    var_dump($data);
  • 27-01-2020, 15:11:49
    #9
    coder63 adlı üyeden alıntı: mesajı görüntüle
    <?php
    function curlFunction($url)
    {
    $ch = curl_init ();
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    
    $response = curl_exec($ch);
    curl_close($ch);
    
    return $response;
    }
    
    $url = "https://www.gokmenoyuncak.com/";
    $data = curlFunction($url);
    
    var_dump($data);
    Hocam çalıştı çok çok teşekkür ederim