Zhihua Wu wrote:
Dear all, I have encountered a problem when I invoke Wiki API in C# by "POST". The result I get is that:
<?xml version="1.0" ?>
<api>
<query>
<allpages> <p pageid="290" ns="0" title="A" /> <p pageid="13547196" ns="0" title="A"" /> <p pageid="9068190" ns="0" title="A"H" /> <p pageid="9068184" ns="0" title="A"h" /> <p pageid="9192091" ns="0" title="A$" /> <p pageid="27551355" ns="0" title="A$$hole: How I Got Rich & Happy by Not
Giving a Damn About Anyone & How You Can, Too" />
<p pageid="27551358" ns="0" title="A$$hole: How I Got Rich and Happy by Not Giving a Shit About You" /> <p pageid="3566260" ns="0" title="A&A" /> <p pageid="11298846" ns="0" title="A&AEE" /> <p pageid="24081644" ns="0" title="A&AS" /> <p pageid="28397693" ns="0" title="A&A (disambiguation)" /> <p pageid="20546645" ns="0" title="A&A Building" />
This looks like the result of http://en.wikipedia.org/w/api.php?action=query&list=allpages&apprefi... Looks a bit odd, as you are posting xml with the entities unescaped.
http.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; WindowsNT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)";
Don't try to disguise yourself as a browser. It is considered of bad education and can lead to being blocked. Use a specific UserAgent which allow to contact you if your bot breaks something.
It's wrong; first the pageid is not right ;
Why isn't it right?
sencond, the title is not available in the wiki. The encoding and decoding both use "utf-8".
Have you % encoded the special characters? Just appending "http://en.wikipedia.org/wiki/" + "A"H" won't work.
I have tried many methods, but I still can't solve it. Please give me a help. I need that. But when I access wiki in IE8.0 or firefox by "GET", the result is right. I can't get where is wrong.
You don't even state what you want...