Tag:

使用PHP发送json文章

我有这个数据: { userID: 'a7664093-502e-4d2b-bf30-25a2b26d6021', itemKind: 0, value: 1, description: 'Boa saudaÁ„o.', itemID: '03e76d0a-8bab-11e0-8250-000c29b481aa' } 我需要张贴到JSONurl: http : //onleague.stormrise.pt : 8031/ OnLeagueRest/resources/onleague/Account/ CreditAccount 使用PHP我怎么能发送这个职位?

System.Net.Http:缺less命名空间? (使用.net 4.5)

TL; DR:我是这个语言的新手,不知道自己在做什么 这是我的课到目前为止: using System; using System.Collections.Generic; using System.Net.Http; using System.Web; using System.Net; using System.IO; public class MyClass { private const string URL = "https://sub.domain.com/objects.json?api_key=123"; private const string data = @"{""object"":{""name"":""Title""}}"; public static void CreateObject() { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); request.Method = "POST"; request.ContentType = "application/json"; request.ContentLength = data.Length; StreamWriter requestWriter = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII); […]

如何通过AJAX发送“&”(&符)字符?

我想从JavaScript发送一些variables和POST方法的string。 我从数据库中获取string,然后将其发送到PHP页面。 我正在使用XMLHttpRequest对象。 问题是该string包含字符“&”几次,PHP中的$ _POST数组看起来像多个键。 我尝试用replace()函数replace“&”,但似乎没有做任何事情。 谁能帮忙? JavaScript代码和string如下所示: var wysiwyg = dijit.byId("wysiwyg").get("value"); var wysiwyg_clean = wysiwyg.replace('&','\&'); var poststr = "act=save"; poststr+="&titlu="+frm.value.titlu; poststr+="&sectiune="+frm.value.sectiune; poststr+="&wysiwyg="+wysiwyg_clean; poststr+="&id_text="+frm.value.id_text; xmlhttp.open("POST","lista_ajax.php",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send(poststr); string是: <span class="style2">&quot;Busola&quot;</span>

POST请求发送json数据java HttpUrlConnection

我已经开发了一个java代码,使用URL和HttpUrlConnection将下面的cURL转换为java代码。 curl是: curl -i 'http://url.com' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"auth": { "passwordCredentials": {"username": "adm", "password": "pwd"},"tenantName":"adm"}}' 我已经写了这个代码,但它总是给HTTP代码400不好的请求。 我找不到缺less的东西。 String url="http://url.com"; URL object=new URL(url); HttpURLConnection con = (HttpURLConnection) object.openConnection(); con.setDoOutput(true); con.setDoInput(true); con.setRequestProperty("Content-Type", "application/json"); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); JSONObject cred = new JSONObject(); JSONObject auth = new JSONObject(); JSONObject parent = new JSONObject(); […]

jQuery发送string作为POST参数

我想发送一个string作为ajax Post参数。 以下代码: $.ajax({ type: "POST", url: "http://nakolesah.ru/", data: 'foo=bar&ca$libri=no$libri', success: function(msg){ alert('wow'+msg); } }); 不pipe用。 为什么?

发送Content-Type:application / json post与node.js

我们如何在NodeJS中这样做一个HTTP请求? 示例或模块表示赞赏。 curl https://www.googleapis.com/urlshortener/v1/url \ -H 'Content-Type: application/json' \ -d '{"longUrl": "http://www.google.com/"}'

我如何发送POST请求作为JSON?

data = { 'ids': [12, 3, 4, 5, 6 , …] } urllib2.urlopen("http://abc.com/api/posts/create",urllib.urlencode(data)) 我想发送一个POST请求,但其中一个字段应该是一个数字列表。 我怎样才能做到这一点 ? (JSON?)

在没有实体的情况下执行HTTP POST被认为是不好的做法?

我需要调用一个不需要用户input的进程,只需要一个触发器。 我打算使用POST / uri没有身体来触发这个过程。 我想知道从HTTP和REST的angular度来看,这是否被认为是不好的?

用php通过POST提交multidimensional array

我有一个具有已知数量的列(例如顶部直径,底部直径,结构,颜色,数量)的PHP表单,但具有未知数量的行,因为用户可以根据需要添加行。 我已经发现了如何把每个字段(列)放在一个他们自己的数组中。 <input name="topdiameter['+current+']" type="text" id="topdiameter'+current+'" size="5" /> <input name="bottomdiameter['+current+']" type="text" id="bottomdiameter'+current+'" size="5" /> 所以我最终在HTML中是: <tr> <td><input name="topdiameter[0]" type="text" id="topdiameter0" size="5" /></td> <td><input name="bottomdiameter[0]" type="text" id="bottomdiameter0" size="5" /></td> </tr> <tr> <td><input name="topdiameter[1]" type="text" id="topdiameter1" size="5" /></td> <td><input name="bottomdiameter[1]" type="text" id="bottomdiameter1" size="5" /></td> </tr> …and so on. 我现在想要做的是把所有的行和列放到一个multidimensional array中,并将其内容发送到客户端(最好是格式化好的表格)。 我还没有能够真正理解如何将所有这些input和select组合成一个不错的数组。 在这一点上,我将不得不尝试使用几个一维数组,虽然我有一个想法,使用单个二维数组将是比使用几个一维数组更好的做法。

Firefox附加RESTclient – 如何inputPOST参数?

我已经安装了Firefox RESTclient插件,但是我很难搞清楚如何传递POST参数。 有没有一个特定的格式来做到这一点? 还是有没有其他工具可以用来在Mac OS X上debuggingREST API?