2017-02-28 19:46
浏览 116

C#/ JSON转换为PHP脚本

I need to extract data from a website's REST api, but I've never worked with it, and I'm just getting back into coding again after some time. But I need to get this project moving in a forward direction very quickly, and cannot for the life of me, figure out how to convert this C#/JSON string into a php equivalent script to poll for the data I need...

HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(address);
httpWebRequest.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}",UserName, Password))));

I'm thinking I need to use curl for this, but again, it's been a long time, and I'm a little rusty. Any help is greatly appreciated.

图片转代码服务由CSDN问答提供 功能建议

我需要从网站的REST api中提取数据,但我从来没有使用它,我是 一段时间后再次重新编码。 但是我需要让这个项目很快向前移动,并且不能为我的生活,找出如何将这个C#/ JSON字符串转换为PHP等效脚本来轮询我需要的数据......

  HttpWebRequest httpWebRequest =(HttpWebRequest)WebRequest.Create(address); 
httpWebRequest.Headers.Add(“Authorization”,“Basic”+ Convert.ToBase64String(System.Text.ASCIIEncoding。  ASCII.GetBytes(string.Format(“{0}:{1}”,UserName,Password)))); 

我想我需要 为此使用卷曲,但是,这已经很长一段时间了,我有点生疏了。 非常感谢任何帮助。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题