• May 4, 2023

    การดึง ไฟล์เว็บอื่นมาใช้ หากเว็บนั้นล่ม เว็บเราจะล่มโหลดไม่ขึ้นไปด้วย ต่อไปนี้คือ การเขี
    javascript

    const link = document.querySelector('#external-link');
    
    const timeoutId = setTimeout(() => {
      link.removeEventListener('load', handleLinkLoad);
      link.remove();
    }, 10000); // 10 seconds timeout
    
    const handleLinkLoad = () => {
      clearTimeout(timeoutId);
    };
    
    link.addEventListener('load', handleLinkLoad);
    
    หรือ จะใช้ php ก็ได้
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10); // 10 seconds timeout
    $response = curl_exec($ch);
    curl_close($ch);
    
    if (!$response) {
        // Handle timeout or other errors here
    } else {
        // Process the response here
    }
    


เวอไนน์ไอคอร์ส

ประหยัดเวลากว่า 100 เท่า!






เวอไนน์เว็บไซต์⚡️
สร้างเว็บไซต์ ดูแลเว็บไซต์

Categories