Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to retrieve CodeProject article data for my blog. I have a few questions.

1) Is is legal?
2) Is it safe?
3) I want to get 'Latest Articles' part of the main page. However, I just want the ttile and the link of article. Is it possible?

4) How can i do that if safe and legal?

C#
string url = "http://www.codeproject.com/";
           try
           {
               HttpWebRequest istek = (HttpWebRequest)WebRequest.Create(url);

               istek.AllowAutoRedirect = true;
               istek.Credentials = CredentialCache.DefaultCredentials;
               istek.Proxy = WebRequest.GetSystemWebProxy();
               istek.UseDefaultCredentials = true;
               istek.UserAgent = "CodeProject Bot";
               HttpWebResponse yanit = (HttpWebResponse)istek.GetResponse();
               StreamReader okuyucu = new StreamReader(yanit.GetResponseStream());
               string gelenKaynak = okuyucu.ReadToEnd();
               int IcerikBaslangicIndex = gelenKaynak.IndexOf("<div id=" + '"' + "arttypes" + '"' + ">") + 30;
               int IcerikBitisIndex = gelenKaynak.Substring(IcerikBaslangicIndex).IndexOf("</div>");

               string final = System.Web.HttpUtility.HtmlDecode(gelenKaynak.Substring(IcerikBaslangicIndex, IcerikBitisIndex)).ToString();

               string[] sonuc;
               string[] stringSeparators = new string[] { "<div class=" + '"' + "row" + '"' + ">" };


               sonuc = final.Split(stringSeparators, StringSplitOptions.None);
               return sonuc;
           }
           catch (Exception)
           {

               throw;
           }



I am getting totaly nonsense part of codeproject. What am I missing?
Posted

You need to post your question in the Article Writing or Bugs & Sugs forum, so one of the site administrators can advise whether you are allowed to do this.
 
Share this answer
 
Hi,

In addition to Richards advice, if you receive clarification from the site owners that they are ok with you doing this, you could have a look at the CodeProject API[^]

... specifically the GetArticles Method[^] ... as this is provided to expose CodePorject Articles/Blogs/Tips.

... hope it helps
 
Share this answer
 
Comments
FoxRoot 17-Sep-15 7:48am    
How can i use this?
https://api.codeproject.com/Help/Api/GET-V1-Articles_tags_minRating_page
hypermellow 17-Sep-15 7:54am    
Hi, there is a few samples provided:
https://api.codeproject.com/Samples

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900