08-11-19, 05:47 PM
محتاح احول كود بسيط من c# الي فيجوال بيسك
كود :
private string GetToken(string User, string pass)
{
string result;
try
{
string str = "https://api.facebook.com/restserver.php";
string str2 = "62f8ce9f74b12f84c1231cc223437a4a32";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("api_key", "882a84903612da987032bf97a021ddc14d");
dictionary.Add("credentials_type", "password");
dictionary.Add("email", User);
dictionary.Add("format", "JSON");
dictionary.Add("generate_machine_id", "1");
dictionary.Add("generate_session_cookies", "1");
dictionary.Add("locale", "en_CA");
dictionary.Add("method", "auth.login");
dictionary.Add("password", pass);
dictionary.Add("return_ssl_resources", "0");
dictionary.Add("v", "1.0");
string text = string.Empty;
foreach (KeyValuePair<string, string> keyValuePair in dictionary)
{
text = text + keyValuePair.Key + "=" + keyValuePair.Value;
}
text += str2;
text = Form1.PHPMd5Hash(text).ToLower();
dictionary.Add("sig", text);
string url = str + "?" + QueryStringBuilder.BuildQueryString(dictionary, "&");
result = (string)JObject.Parse(this.GET(url))["access_token"];
}
catch
{
result = null;
}
return result;
}