• 26-02-2023, 13:47:38
    #1
    Selam arkadaşlar botun normalde çalışıyordu fakat şu an genel olarak doğru olmasına rağmen bi yerde hata var.

    İnceleyip yardımcı olabilir misiniz?
    Kodun bir kısmı:


    function milliyet($burc)
    {
        global $step;
        $ch = curl_init();
    
        curl_setopt($ch, CURLOPT_URL, 'https://www.milliyet.com.tr/pembenar/'.$burc.'-burcu-haftalik-yorum/');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
        curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
        $headers = array();
        $headers[] = 'Authority: www.milliyet.com.tr';
        $headers[] = 'Cache-Control: max-age=0';
        $headers[] = 'Sec-Ch-Ua: \"Google Chrome\";v=\"93\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"93\"';
        $headers[] = 'Sec-Ch-Ua-Mobile: ?0';
        $headers[] = 'Sec-Ch-Ua-Platform: \"macOS\"';
        $headers[] = 'Upgrade-Insecure-Requests: 1';
        $headers[] = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36';
        $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9';
        $headers[] = 'Sec-Fetch-Site: same-origin';
        $headers[] = 'Sec-Fetch-Mode: navigate';
        $headers[] = 'Sec-Fetch-User: ?1';
        $headers[] = 'Sec-Fetch-Dest: document';
        $headers[] = 'Accept-Language: tr,ru;q=0.9,en;q=0.8,tr-TR;q=0.7,en-US;q=0.6,la;q=0.5';
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
        $result = curl_exec($ch);
        if (curl_errno($ch)) {
            echo 'Error:' . curl_error($ch);
        }
        curl_close($ch);
    
        $dom = new DOMDocument();
        @$dom->loadHTML(mb_convert_encoding($result, 'HTML-ENTITIES', 'UTF-8'));
        $xpath = new DOMXPath($dom);
        return trim($xpath->query("/html/body/div[3]/div[2]/div[1]/div[1]/article/section[1]/div/p")->item(0)->textContent);
    }
  • 26-02-2023, 13:52:58
    #2
    Backend Developer
    Merhaba içerideki yorumları almaya çalışıyorsunuz sanırım buyrun:
    function milliyet($burc)
    {
        global $step;
        $ch = curl_init();
    
        curl_setopt($ch, CURLOPT_URL, 'https://www.milliyet.com.tr/pembenar/'.$burc.'-burcu-haftalik-yorum/');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
        curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
        $headers = array();
        $headers[] = 'Authority: www.milliyet.com.tr';
        $headers[] = 'Cache-Control: max-age=0';
        $headers[] = 'Sec-Ch-Ua: \"Google Chrome\";v=\"93\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"93\"';
        $headers[] = 'Sec-Ch-Ua-Mobile: ?0';
        $headers[] = 'Sec-Ch-Ua-Platform: \"macOS\"';
        $headers[] = 'Upgrade-Insecure-Requests: 1';
        $headers[] = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36';
        $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9';
        $headers[] = 'Sec-Fetch-Site: same-origin';
        $headers[] = 'Sec-Fetch-Mode: navigate';
        $headers[] = 'Sec-Fetch-User: ?1';
        $headers[] = 'Sec-Fetch-Dest: document';
        $headers[] = 'Accept-Language: tr,ru;q=0.9,en;q=0.8,tr-TR;q=0.7,en-US;q=0.6,la;q=0.5';
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
        $result = curl_exec($ch);
        if (curl_errno($ch)) {
            echo 'Error:' . curl_error($ch);
        }
        curl_close($ch);
        preg_match_all('@(.*?)<div class="horoscope-tabs__content__main-inner">(.*?)\n(.*?)\n(.*?)</div>(.*?)@',$result,$desc);
        return ltrim(rtrim(strip_tags($desc['3']['0'])));
    }
  • 26-02-2023, 13:58:16
    #3
    LENOX adlı üyeden alıntı: mesajı görüntüle
    Merhaba içerideki yorumları almaya çalışıyorsunuz sanırım buyrun:
    function milliyet($burc)
    {
        global $step;
        $ch = curl_init();
    
        curl_setopt($ch, CURLOPT_URL, 'https://www.milliyet.com.tr/pembenar/'.$burc.'-burcu-haftalik-yorum/');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
        curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
        $headers = array();
        $headers[] = 'Authority: www.milliyet.com.tr';
        $headers[] = 'Cache-Control: max-age=0';
        $headers[] = 'Sec-Ch-Ua: \"Google Chrome\";v=\"93\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"93\"';
        $headers[] = 'Sec-Ch-Ua-Mobile: ?0';
        $headers[] = 'Sec-Ch-Ua-Platform: \"macOS\"';
        $headers[] = 'Upgrade-Insecure-Requests: 1';
        $headers[] = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36';
        $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9';
        $headers[] = 'Sec-Fetch-Site: same-origin';
        $headers[] = 'Sec-Fetch-Mode: navigate';
        $headers[] = 'Sec-Fetch-User: ?1';
        $headers[] = 'Sec-Fetch-Dest: document';
        $headers[] = 'Accept-Language: tr,ru;q=0.9,en;q=0.8,tr-TR;q=0.7,en-US;q=0.6,la;q=0.5';
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
        $result = curl_exec($ch);
        if (curl_errno($ch)) {
            echo 'Error:' . curl_error($ch);
        }
        curl_close($ch);
        preg_match_all('@(.*?)<div class="horoscope-tabs__content__main-inner">(.*?)\n(.*?)\n(.*?)</div>(.*?)@',$result,$desc);
        return ltrim(rtrim(strip_tags($desc['3']['0'])));
    }

    Çalıştı çok teşekkür ederim