-5

I search the stackoverflow.com for my issue,and i found this answer related to mine.the problem is i dont know how to apply this code to my asp.net mvc web site

<?php
$string = file_get_contents('http://steamcommunity.com/market/listings/730/AK-47%20|%20Vulcan%20%28Battle-Scarred%29');
$attrList = explode('<span class="market_listing_price market_listing_price_with_fee">',$string);
$N=count($attrList);
for ($i=1;$i<$N;$i++){
    $prices[$i-1] = explode('</span>',$attrList[$i])[0];
}
print_r($prices);
?>
fgocken
  • 5
  • 2

1 Answers1

0

Something along the lines of:

var wc = new WebClient();
var pageAsString = wc.DownloadString(new Uri("http://steamcommunity.com/market/listings/730/AK-47%20|%20Vulcan%20%28Battle-Scarred%29"));

var attrList = pageAsString.Split(new string[] { "<span class=\"market_listing_price market_listing_price_with_fee\">"}, StringSplitOptions.RemoveEmptyEntries);

var prices = new List<string>();

for (var i = 1; i < attrList.Count(); i++)
{
    prices.Add(attrList[i].Split(new string[] { "</span>" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault().Trim());
}

// Do something with prices variable
Luke
  • 22,826
  • 31
  • 110
  • 193