Ikham โพสต์ 2014-9-12 22:47:21

ส่ง/อัพเดต sitemap อัตโนมัติ Google Bing Yahoo Ask

แก้ไขครั้งสุดท้ายโดย Ikham เมื่อ 2014-9-12 22:47

Ping Sitemaps คืออะไร

หลังจากที่ติดตั้งปลั๊กอิน sitemap เสร็จแล้วให้ไปตั้งอัพเดตอัตโนมัติ อย่างของผมตั้งทุกวันที่ 20 เวลา 2.00 น



จากนั้นก๊อปโค๊ด
function SendSiteMapUpdateIndicationPing($sitemap_url){
      $curl_req = array();
      $urls = array();
      // below are the SEs that we will be pining
      $urls[] = "http://www.google.com/webmasters/tools/ping?sitemap=ที่อยู่ site แบบเต็ม".urlencode($sitemap_url);
      $urls[] = "http://www.bing.com/webmaster/ping.aspx?siteMap=ที่อยู่ site แบบเต็ม".urlencode($sitemap_url);
      $urls[] = "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=YahooDemo&url=ที่อยู่ site แบบเต็ม".urlencode($sitemap_url);
      $urls[] = "http://submissions.ask.com/ping?sitemap=ที่อยู่ site แบบเต็ม".urlencode($sitemap_url);

      foreach ($urls as $url)
      {
            $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL, $url);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($curl, CURL_HTTP_VERSION_1_1, 1);
            $curl_req[] = $curl;
      }
      //initiating multi handler
      $multiHandle = curl_multi_init();

      // adding all the single handler to a multi handler
      foreach($curl_req as $key => $curl)
      {
            curl_multi_add_handle($multiHandle,$curl);
      }
      $isactive = null;
      do
      {
            $multi_curl = curl_multi_exec($multiHandle, $isactive);
      }
      while ($isactive || $multi_curl == CURLM_CALL_MULTI_PERFORM );

      $success = true;
      foreach($curl_req as $curlO)
      {
            if(curl_errno($curlO) != CURLE_OK)
            {
                $success = false;
            }
      }
      curl_multi_close($multiHandle);
      return $success;
    }

เปลี่ยน

$urls[] = "http://www.google.com/webmasters/tools/ping?sitemap=ที่อยู่ site แบบเต็ม".urlencode($sitemap_url);
      $urls[] = "http://www.bing.com/webmaster/ping.aspx?siteMap=ที่อยู่ site แบบเต็ม".urlencode($sitemap_url);
      $urls[] = "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=YahooDemo&url=ที่อยู่ site แบบเต็ม".urlencode($sitemap_url);
      $urls[] = "http://submissions.ask.com/ping?sitemap=ที่อยู่ site แบบเต็ม".urlencode($sitemap_url);

เป็นที่อยู่ sitemapของท่าน จากนั้นเซพเป็นไฟล์ php แล้วอัพไปไว้ที่ source/include/cron
เข้า admincp > เครื่องมือ > แผนงานระบบ จากนั้นทำตามรูป




เสร็จ

mrkran โพสต์ 2014-9-13 14:35:27

ปัญหาที่คน 10 คน อ่านแล้วจะถามกลับทันที 10 คน

จาก หลังจากที่ติดตั้งปลั๊กอิน sitemap เสร็จ

แล้วมันปลั๊กอินตัวไหน ลิงก์ไหน หละครับ ขอขอบคุณสำหรับสิ่งที่แบ่งปัน แต่รายละเอียดมันต้องชัดเจนนะครับ

Ikham โพสต์ 2014-9-13 21:26:54

mrkran ตอบกลับเมื่อ 2014-9-13 14:35
ปัญหาที่คน 10 คน อ่านแล้วจะถามกลับทันที 10 คน

จาก


ตัวนี้ครับ http://addon.discuz.com/?@sitemap.plugin

rokaisakkon โพสต์ 2014-9-13 21:43:17

ผมทำไว้เหมือนกัน เรียวทาม 555

http://7nime.com/../sitemap.xml_google_0.xml

natdanaic65 โพสต์ 2014-9-17 21:31:07

http://addon.discuz.com/?@sitemap.plugin << โหลดยังไงหรอคับท่าน T-T ภาษาจีนเต็มเลยดูไม่ออกเลยคับ

Ikham โพสต์ 2014-9-17 22:29:31

natdanaic65 ตอบกลับเมื่อ 2014-9-17 21:31
http://addon.discuz.com/?@sitemap.plugin

ผมโหลดจากเมนูปลั๊กอินใน admincp ค้าหาคำว่า sitemap
ตัวปลั๊กอินเป็นภาษาจีนทั้งหมดผมเองก็งมเอา ถ้ามีใครเอาไปแปลจะดีมาก

natdanaic65 โพสต์ 2014-9-17 22:34:00

Ikham ตอบกลับเมื่อ 2014-9-17 22:29
ผมโหลดจากเมนูปลั๊กอินใน admincp ค้าหาคำว่า sitemap
ตัวปลั๊ ...

อ่อคับ ขอบคุณมากคับ เดียวจะลองดูคับ

natdanaic65 โพสต์ 2014-9-17 22:49:53

ขอถามต่อหน่อยนะคับ

1.ทำไมของผมไม่มี เหมือนในกรอบสีแดง อ่ะคับ
http://image.ohozaa.com/i/e4f/TAuG4e.png

2.ที่บอกให้ก็อปโค้ดอ่ะคับ ให้ก็อปไปแก้ที่ไฟล์ไหนหรอคับ

เพิ่มเนื้อหา (2014-9-17 22:51):
http://image.ohozaa.com/i/4f7/MQ5GFM.png รูปนี้คับ ผิดรูป

natdanaic65 โพสต์ 2014-9-21 21:47:02

มีใครพอช่วยได้มั้งไหมคับบ

gu_1n โพสต์ 2016-5-27 07:45:19

ดูจากโค้ดแล้วมันเหมือนจะเป็นฟังค์ชั่น php ที่ user define ขึ้นมาเฉยๆ
ถ้าไม่สั่งรันแล้วมันคงไม่น่าจะทำงานนะครับ

ผมดัดแปลงใหม่ให้มันใช้งานได้ เผื่อใครอาจจะสนใจ
function SendSiteMapUpdateIndicationPing($sitemap_url){
      $curl_req = array();
      $urls = array();
      // below are the SEs that we will be pining
      $urls[] = "http://www.google.com/webmasters/tools/ping?sitemap=".urlencode($sitemap_url);
      $urls[] = "http://www.bing.com/webmaster/ping.aspx?siteMap=".urlencode($sitemap_url);
      $urls[] = "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=YahooDemo&amp;url=".urlencode($sitemap_url);
      $urls[] = "http://submissions.ask.com/ping?sitemap=".urlencode($sitemap_url);

      foreach ($urls as $url)
      {
            $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL, $url);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($curl, CURL_HTTP_VERSION_1_1, 1);
            $curl_req[] = $curl;
      }
      //initiating multi handler
      $multiHandle = curl_multi_init();

      // adding all the single handler to a multi handler
      foreach($curl_req as $key => $curl)
      {
            curl_multi_add_handle($multiHandle,$curl);
      }
      $isactive = null;
      do
      {
            $multi_curl = curl_multi_exec($multiHandle, $isactive);
      }
      while ($isactive || $multi_curl == CURLM_CALL_MULTI_PERFORM );

      $success = 'Ping Success';
      foreach($curl_req as $curlO)
      {
            if(curl_errno($curlO) != CURLE_OK)
            {
                $success = 'Ping Error';
            }
      }
      curl_multi_close($multiHandle);
      echo $success;
    }

ในเมื่อเรา define function เสร็จแล้ว
ต่อไปก็ถึงเวลาเรียกฟังค์ชั่นให้มันทำงานเวลารันไฟล์สคริปผ่าน cron

SendSiteMapUpdateIndicationPing("http://yourdomain/yoursitemapfile.xml");

สรุปเอามารวมกัน ได้เป็น
function SendSiteMapUpdateIndicationPing($sitemap_url){
      $curl_req = array();
      $urls = array();
      // below are the SEs that we will be pining
      $urls[] = "http://www.google.com/webmasters/tools/ping?sitemap=".urlencode($sitemap_url);
      $urls[] = "http://www.bing.com/webmaster/ping.aspx?siteMap=".urlencode($sitemap_url);
      $urls[] = "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=YahooDemo&amp;url=".urlencode($sitemap_url);
      $urls[] = "http://submissions.ask.com/ping?sitemap=".urlencode($sitemap_url);

      foreach ($urls as $url)
      {
            $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL, $url);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($curl, CURL_HTTP_VERSION_1_1, 1);
            $curl_req[] = $curl;
      }
      //initiating multi handler
      $multiHandle = curl_multi_init();

      // adding all the single handler to a multi handler
      foreach($curl_req as $key => $curl)
      {
            curl_multi_add_handle($multiHandle,$curl);
      }
      $isactive = null;
      do
      {
            $multi_curl = curl_multi_exec($multiHandle, $isactive);
      }
      while ($isactive || $multi_curl == CURLM_CALL_MULTI_PERFORM );

      $success = "Ping Success";
      foreach($curl_req as $curlO)
      {
            if(curl_errno($curlO) != CURLE_OK)
            {
                $success = 'Ping Error';
            }
      }
      curl_multi_close($multiHandle);
      echo $success;
    }
SendSiteMapUpdateIndicationPing("http://yourdomain/yoursitemapfile.xml");

เพิ่มเนื้อหา (2016-5-27 07:47):
เสร็จแล้วก็ Save เป็น php และก็นำไปไว้ตามที่เจ้าของกระทู้บอกมาครับ
และถึงเอาไฟล์ไปเพิ่มในระบบ cron ของ discuz

เพิ่มเนื้อหา (2016-5-27 07:52):
หากผิดพลาดตรงไหนขอโทษล่วงหน้านะครับ
แต่ผมลองทำตามนี้แล้วมันใช้ได้

เมื่อก่อนเคยทำตามวิธีของจขกท (ใช้มา 3 ปี) นานๆ bot จะมาเก็บไฟล์ sitemap ที
ตอนนี้แก้ใหม่ มันมาเก็บทุกวันตาม cron schedule เลย
หน้า: [1]
ดูในรูปแบบกติ: ส่ง/อัพเดต sitemap อัตโนมัติ Google Bing Yahoo Ask