开发者

send ping after post something (for blogs)

开发者 https://www.devze.com 2023-01-10 19:55 出处:网络
I want to send some pings after post something to my blog. As you know wordpress use this method. I coded my own blog system and I want to send pings some web address.

I want to send some pings after post something to my blog. As you know wordpress use this method. I coded my own blog system and I want to send pings some web address.

For example I want to request this link. www.google.com/webmasters/tools/ping?sitemap=http://www.domain.com/sitemap.ashx

http://pingomatic.com/ping/?title=y&blogurl=&rssurl=&chk_weblogscom=on&chk_blogs=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator开发者_JAVA百科=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_blogstreet=on&chk_moreover=on&chk_weblogalot=on&chk_icerocket=on&chk_newsisfree=on&chk_topicexchange=on&chk_google=on&chk_tailrank=on&chk_bloglines=on&chk_postrank=on&chk_skygrid=on&chk_collecta=on&chk_superfeedr=on&chk_audioweblogs=on&chk_rubhub=on&chk_geourl=on&chk_a2b=on&chk_blogshares=on

System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping();
                    System.Net.NetworkInformation.PingReply prep;

                    string url = "http://www.google.com/webmasters/tools/ping?sitemap=" + sitename + "/sitemap.ashx";

                    prep = p.Send(url);

                    if (prep.Status == System.Net.NetworkInformation.IPStatus.Success)
                    {
                        string address = prep.Address.ToString();
                        string time = prep.RoundtripTime.ToString();
                    }
                    else
                    {
                        string status = prep.Status.ToString();
                    }

This code is not working for me. Any other way?


From what I know the ping is done on a computer ip and I see that you call a web page.

Maybe you need to send a web request and not a ping.

Here is an example

http://msdn.microsoft.com/en-us/library/debx8sh9.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消