Cevaplar
-
php kodlarını c# çevirmekten daha mantıklısı online xml veya json olarak havadurumu bilgilerini veren siteleri kullanmaktır.
yada hiç olmadı bu php kodundan xml çıktı üretip c# la okutabilirsin-
imeilim
öncelikle cevabınız için çok teşekkürler.
Elimdeki script çok güzel efektli filan güzel bir hava durumu isterseniz gönderebilirim hazır servisler yerine bunu kullanmak isterim.
Ancak dediğiniz olayı yani phpden xml çıktı almayı da malesef nasıl yapılacağını bilmiyorum.
Neyse yine de çok teşekkürler..12 yıl önce yazılmış
-
-
google wheather apisini kullanarak aliyosun. buyur burda c# ta nasil kullanacagin.
http://www.dreamincode.net/forums/topic/153911-using-google-weather-api-in-a-c%23-application/-
imeilim
Yapamadım ya bir türlü.
İyi anlayan bir arkadaş çevirse şunu eminim birçok kişinin işine yarar.12 yıl önce yazılmış
-
-
wwww.bluedolphins.com.tr
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Reflection;
using runnerDotNet;
namespace runnerDotNet
{
public partial class GlobalController : BaseController
{
public XVar code()
{
try
{
dynamic ch = null, condition = null, data = null, humidity = null, i = null, icon = null, img = null, old = null, place = null, placename = null, raw_data = null, temp_c = null, url = null, var_new = null, xml = null;
placename = new XVar("İstanbul");
place = XVar.Clone(CommonFunctions.urlencode((XVar)(placename)));
place = XVar.Clone(CommonFunctions.utf8_encode((XVar)(place)));
url = XVar.Clone(MVCFunctions.Concat("<a href="http://www.google.com/ig/api?weather="" target="_blank" class="external" rel="nofollow">http://www.google.com/ig/api?weather="</a>, place, ",$&hl=tr"));
ch = XVar.Clone(CommonFunctions.curl_init());
CommonFunctions.curl_setopt((XVar)(ch), new XVar(Constants.CURLOPT_RETURNTRANSFER), new XVar(1));
CommonFunctions.curl_setopt((XVar)(ch), new XVar(Constants.CURLOPT_URL), (XVar)(url));
CommonFunctions.curl_setopt((XVar)(ch), new XVar(Constants.CURLOPT_USERAGENT), (XVar)(MVCFunctions.GetServerVariable("HTTP_USER_AGENT")));
CommonFunctions.curl_setopt((XVar)(ch), new XVar(Constants.CURLOPT_TIMEOUT), new XVar(60));
CommonFunctions.curl_setopt((XVar)(ch), new XVar(Constants.CURLOPT_FOLLOWLOCATION), new XVar(0));
raw_data = XVar.Clone(CommonFunctions.curl_exec((XVar)(ch)));
CommonFunctions.curl_close((XVar)(ch));
xml = XVar.Clone(CommonFunctions.simplexml_load_string((XVar)(raw_data)));
condition = XVar.Clone(xml.weather.current_conditions.condition["data"]);
temp_c = XVar.Clone(xml.weather.current_conditions.temp_c["data"]);
humidity = XVar.Clone(xml.weather.current_conditions.humidity["data"]);
icon = XVar.Clone(xml.weather.current_conditions.icon["data"]);
MVCFunctions.Echo("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank" class="external" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>\">\r\n<html xmlns=\"<a href="http://www.w3.org/1999/xhtml" target="_blank" class="external" rel="nofollow">http://www.w3.org/1999/xhtml</a>\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n<title>jQuery Weather</title>\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\"css/reset.css\" />\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.css\" />\r\n");
MVCFunctions.Echo("<s");
MVCFunctions.Echo("cript src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js\" type=\"text/javascript\"></script>\r\n");
MVCFunctions.Echo("<s");
MVCFunctions.Echo("cript src=\"js/jquery.scrollTo-1.3.3.js\" type=\"text/javascript\"></script>\r\n");
MVCFunctions.Echo("<s");
MVCFunctions.Echo("cript src=\"js/jquery.localscroll-1.2.5.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\r\n");
MVCFunctions.Echo("<s");
MVCFunctions.Echo("cript src=\"js/jquery.serialScroll-1.2.1.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\r\n");
MVCFunctions.Echo("<s");
MVCFunctions.Echo("cript src=\"js/coda-slider.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\r\n</head>\r\n\r\n<body>\r\n<div id=\"wrapper\" title=\"Herhangi bir gün seçebilirsiniz\">\r\n<div id=\"weatherBg\">\r\n<div class=\"scroll\">\r\n<div class=\"scrollContainer\">\r\n");
i = new XVar(0);
for(;i < MVCFunctions.count(xml.weather.forecast_conditions); i++)
{
data = XVar.Clone(xml.weather.forecast_conditions[i]);
MVCFunctions.Echo("<div id=\"");
MVCFunctions.Echo(data.day_of_week["data"]);
MVCFunctions.Echo("\">\r\n<div class=\"todayWeather\">\r\n<div class=\"todayImage\"> <img src=\"\r\n");
old = XVar.Clone(new XVar(0, "/ig/images/weather/"));
var_new = XVar.Clone(new XVar(0, "images/weather/"));
img = XVar.Clone(CommonFunctions.str_replace((XVar)(old), (XVar)(var_new), (XVar)(data.icon["data"])));
old = XVar.Clone(new XVar(0, ".gif"));
var_new = XVar.Clone(new XVar(0, ".png"));
img = XVar.Clone(CommonFunctions.str_replace((XVar)(old), (XVar)(var_new), (XVar)(img)));
MVCFunctions.Echo(img);
MVCFunctions.Echo("\"\r\nalt=\"");
MVCFunctions.Echo(data.condition["data"]);
MVCFunctions.Echo("\" height=\"80\" width=\"120\" /></div>\r\n<div class=\"todayCondition\">\r\n<h1 class=\"city\"> ");
MVCFunctions.Echo(placename);
MVCFunctions.Echo("</h1>\r\n<h2 class=\"temp\"> ");
MVCFunctions.Echo(data.low["data"]);
MVCFunctions.Echo(" °C | ");
MVCFunctions.Echo(data.high["data"]);
MVCFunctions.Echo(" °C </h2>\r\n<h3 class=\"conditionData\"> ");
MVCFunctions.Echo(data.condition["data"]);
MVCFunctions.Echo("</h3>\r\n</div>\r\n</div>\r\n</div>\r\n");
}
MVCFunctions.Echo("</div>\r\n<!-- end scroll -->\r\n</div>\r\n<!-- end scrollContainer -->\r\n\r\n<div id=\"forecast\">\r\n\r\n");
i = new XVar(0);
for(;i < MVCFunctions.count(xml.weather.forecast_conditions); i++)
{
data = XVar.Clone(xml.weather.forecast_conditions[i]);
MVCFunctions.Echo("<div class=\"weather\" >\r\n<div class=\"weatherDay\"> <a href=\"#");
MVCFunctions.Echo(data.day_of_week["data"]);
MVCFunctions.Echo("\"> ");
MVCFunctions.Echo(data.day_of_week["data"]);
MVCFunctions.Echo(" </a> </div>\r\n<div class=\"weatherImage\" > <img src=\"\r\n");
old = XVar.Clone(new XVar(0, "/ig/images/weather/"));
var_new = XVar.Clone(new XVar(0, "images/weather/"));
img = XVar.Clone(CommonFunctions.str_replace((XVar)(old), (XVar)(var_new), (XVar)(data.icon["data"])));
old = XVar.Clone(new XVar(0, ".gif"));
var_new = XVar.Clone(new XVar(0, ".png"));
img = XVar.Clone(CommonFunctions.str_replace((XVar)(old), (XVar)(var_new), (XVar)(img)));
MVCFunctions.Echo(img);
MVCFunctions.Echo("\" width=\"35\" height=\"25\" alt=\"");
MVCFunctions.Echo(data.condition["data"]);
MVCFunctions.Echo("\" /> </div>\r\n</div>\r\n");
}
MVCFunctions.Echo("\r\n</div> <!-- end forecast -->\r\n\r\n</div> <!-- end weatherBg -->\r\n\r\n</div> <!-- end wrapper-->\r\n</body>\r\n</html>");
return MVCFunctions.GetBuferContentAndClearBufer();
}
catch(RunnerRedirectException ex)
{ return Redirect(ex.Message); }
}
}
}
Konu hakkında destek talebinde bulunabilirsiniz. www.bluedolphins.com.tr