Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
asp.net中有VineAPI吗?_Asp.net_Curl_Vine - Fatal编程技术网

asp.net中有VineAPI吗?

asp.net中有VineAPI吗?,asp.net,curl,vine,Asp.net,Curl,Vine,我正在努力转换asp.net中的VineAPI代码,从这里我发现,有人知道吗 如果有人知道如何将此curl转换为asp.net,我将不胜感激 class Vine { private static $base_url = "https://api.vineapp.com"; private static $referer = "api.vineapp.com"; private static $vine_session = null; private static $vine_id = nul

我正在努力转换asp.net中的VineAPI代码,从这里我发现,有人知道吗

如果有人知道如何将此curl转换为asp.net,我将不胜感激

class Vine {

private static $base_url = "https://api.vineapp.com";
private static $referer = "api.vineapp.com";
private static $vine_session = null;
private static $vine_id = null;

public static function login($username, $password) {
$success = false;
$url = self::$base_url . "/users/authenticate";
$curl = new Curl;
$response = json_decode($curl->post($url, array('username'=>$username, 'password'=>$password)));
if(isset($response->success) and $response->success) {
self::$vine_session = $response->data->key;
self::$vine_id = $response->data->key;
$success = true;
}
return $success;    
}

public static function get_tag($tag) {
$encoded_tag = urlencode($tag);
$url = self::$base_url . "/timelines/tags/$encoded_tag";
$payload = null;
$curl = new Curl;
if(self::$vine_session) {
$curl->headers['vine-session-id'] = self::$vine_session;
}
$response = json_decode($curl->get($url));
if(isset($response->success) and $response->success) {
$payload = $response->data->records;
}
return $payload;
}

}

最后,我成功地使用C#从vine获取提要 做这件事

            string data = "username=yourusername&password=password"; //replace <value>
            byte[] dataStream = Encoding.UTF8.GetBytes(data);
            string urlPath = "https://api.vineapp.com/users/authenticate";
            string request = urlPath;
            WebRequest webRequest = WebRequest.Create(request);
            webRequest.Method = "POST";
            webRequest.ContentType = "application/x-www-form-urlencoded";
            webRequest.ContentLength = dataStream.Length;
            Stream newStream = webRequest.GetRequestStream();
            // Send the data.
            newStream.Write(dataStream, 0, dataStream.Length);
            newStream.Close();
            WebResponse webResponse = webRequest.GetResponse();
            Stream responseStream = webResponse.GetResponseStream();
            StreamReader reader = new StreamReader(responseStream);
            string responseFromServer = reader.ReadToEnd();
            JObject js1 = JObject.Parse(responseFromServer);
            string key=js1["data"]["key"].ToString();

            //GetVineUsers();
            string URL = "https://api.vineapp.com/users/search/"+txtName.Text;

            var webClient = new WebClient();
            webClient.Headers.Add("user-agent", "com.vine.iphone/1.0.3 (unknown, iPhone OS 6.0.1, iPhone, Scale/2.000000)");
            webClient.Headers.Add("vine-session-id", key);
            webClient.Headers.Add("accept-language", "en, sv, fr, de, ja, nl, it, es, pt, pt-PT, da, fi, nb, ko, zh-Hans, zh-Hant, ru, pl, tr, uk, ar, hr, cs, el, he, ro, sk, th, id, ms, en-GB, ca, hu, vi, en-us;q=0.8");
            var json = webClient.DownloadString(URL);
            JObject js = JObject.Parse(json);
            for (int i = 0; i < 19; i++)
            {
                FbUser cls = new FbUser();
                cls.Id = js["data"]["records"][i]["userId"].ToString();
                cls.Name = js["data"]["records"][i]["username"].ToString();
                cls.MediaName = "Vine";
                listFbUsers.Add(cls); 
            }
string data=“username=yourusername&password=password”//代替
字节[]数据流=Encoding.UTF8.GetBytes(数据);
字符串urlPath=”https://api.vineapp.com/users/authenticate";
字符串请求=urlPath;
WebRequest WebRequest=WebRequest.Create(请求);
webRequest.Method=“POST”;
webRequest.ContentType=“application/x-www-form-urlencoded”;
webRequest.ContentLength=dataStream.Length;
Stream newStream=webRequest.GetRequestStream();
//发送数据。
Write(dataStream,0,dataStream.Length);
newStream.Close();
WebResponse WebResponse=webRequest.GetResponse();
Stream responseStream=webResponse.GetResponseStream();
StreamReader=新的StreamReader(responseStream);
字符串responseFromServer=reader.ReadToEnd();
JObject js1=JObject.Parse(responseFromServer);
string key=js1[“data”][“key”].ToString();
//GetVineUsers();
字符串URL=”https://api.vineapp.com/users/search/“+txtName.Text;
var webClient=新的webClient();
webClient.Headers.Add(“用户代理”,“com.vine.iphone/1.0.3(未知,iphone操作系统6.0.1,iphone,Scale/2.000000)”;
添加(“vine会话id”,键);
webClient.Headers.Add(“接受语言”、“en、sv、fr、de、ja、nl、it、es、pt、pt、pt、da、fi、nb、ko、zh-Hans、zh-Hant、ru、pl、tr、uk、ar、hr、cs、el、he、ro、sk、th、id、ms、en-GB、ca、hu、vi、en-us;q=0.8”);
var json=webClient.DownloadString(URL);
JObject js=JObject.Parse(json);
对于(int i=0;i<19;i++)
{
FbUser cls=新FbUser();
cls.Id=js[“数据”][“记录”][i][“用户Id”].ToString();
cls.Name=js[“数据”][“记录”][i][“用户名”].ToString();
cls.MediaName=“Vine”;
添加(cls);
}

我还对使用ASP.net向vineapp发出请求的代码感兴趣