post

What's the easiest way to redirect to the previous page with PHP?

 ̄綄美尐妖づ 提交于 2020-01-05 15:10:13
问题 I'm using a form to submit some post information to a PHP script. After the script finishes, I want it to redirect right back to the page the user came from. Right now I'm just using header() with a static URL. I've found a ton of very conflicting information about this around the internet, so I'm wondering what StackOverflow thinks. 回答1: Use HTTP_REFERER: header('Location: ' . $_SERVER['HTTP_REFERER']); 回答2: access the $_SERVER['HTTP_REFERER'] variable and redirect to this. Should do the

django ajax发送post请求

僤鯓⒐⒋嵵緔 提交于 2020-01-05 10:20:13
第一种:将csrf_token放在from表单里 <script> function add_competion_goods() { $.ajax({ url: "{% url 'add_competition_goods' %}", type: "POST", dataType: "json", data: $('#add_competition_goods_from').serialize(),//直接将from表单打包 success: function () { $('#add_competition_modal').modal('hide'); alert('secces') } }) } </script> 第二种:发送前添加头部信息 <script> function submit_read_save_order_data() { var excel_file = document.getElementById("order_excel").files; var excel_file_size = excel_file[0]['size']; console.log(excel_file_size); if (excel_file_size > 0 & excel_file_size < 60000000) { alert("已开始上传"); $('button

How I can get data after make a POST to an external HTTPS Web Page?

こ雲淡風輕ζ 提交于 2020-01-05 09:25:52
问题 I need to make a POST in JSON format to an HTTPS web page in a remote server and receive an answer in JSON format. The data to be send it to the remote server is take it from the URL (bar)<---Done in PHP My problem is to send this data and receive an answer. I tried making it in PHP, and HTML using cURL(php) and submit(html). The results: In PHP I can't send anything. In HTML I can submit the data, get an answer but I can't catch in my code. I see the answer using Wireshark, and as I see the

Post a string as multipart/form-data using requests

半腔热情 提交于 2020-01-05 09:23:56
问题 I am posting to an API that seems to insist on receiving XML data as multipart/form-data with the name (file name?) xml. It works in postman but I can't get it to work using Python's requests. This is my Python code (based on https://stackoverflow.com/a/24443309/1011724): requests.post(callpro_url, files={'xml':('data.xml',result)}, verify=False).text where result is a string containing XML. If I try this code I get the response: xml post field is empty which is the response this API give if

Post FLV to wall

六月ゝ 毕业季﹏ 提交于 2020-01-05 08:50:50
问题 If I use the Graph API to post something on a user's wall, the "source" attribute doesn't seem to work if the video source is an FLV. What I expect is for Facebook to wrap their native video player around the FLV file, but it doesn't happen. Here's how I'm calling the API: http://i.imgur.com/0LpFJ.jpg Any ideas? 回答1: You can't include FLV content directly; you need to include your own SWF player, and attach the URL of the player you want displayed (passing the FLV source as a parameter in the

Post and Get via CURL

*爱你&永不变心* 提交于 2020-01-05 08:32:32
问题 I'm trying to send information from a form and a hidden email variable (from a db) to a PHP script using cURL. I have the post items moving correctly, but I am not sure if can also send a variable vai the url. (the $_Get) 回答1: A standard querystring should work. 回答2: Try pulling the vars from $_REQUEST, which if i remember correctly is basically $_GET which is then overwritten by $_POST and then $_COOKIE. 来源: https://stackoverflow.com/questions/860701/post-and-get-via-curl

How to get cloned radio buttons to pass their values through to a form process

南楼画角 提交于 2020-01-05 08:18:29
问题 I have an RSVP form (http://adrianandemma.com/) with a name field and a radio for 'Attending - Yes/No'. You can clone these fields to RSVP for more that one guest at a time. I'm trying to carry these field values through to a form process script to send me the RSVPs by email. The name fields are coming through fine, but the radio button values all come through blank. Can see why this might be happening? Here's my HTML form: <form action="?" method="post"> <?php if(@$errors) :?> <p class=

Python automating a wget script with login required

房东的猫 提交于 2020-01-05 08:09:12
问题 I need to automate a download process from a site which requires the following: send an HTTP POST request containing your username and password I should get a cookie (probably containing a session ID) send an HTTP GET request for the file, sending my cookie details in the HTTP headers Using wget now, I must first login with a password (open a session?) : wget --no-check-certificate -O /dev/null --save-cookies auth.rda_ucar_edu --post-data=email=name@domain.edu&passwd=5555&action=login https:/

How to post request and get response with retrofit 2?

我只是一个虾纸丫 提交于 2020-01-05 07:41:37
问题 My service just use post method. in my code : my ApiInterFace Class public interface ApiInterface { @POST("srrvk") @FormUrlEncoded Call<JoinAllAllowedInnoResponse> GETJOINALLOWEDINNOLIST(@Field("a") Integer lastOrderId, @Field("b") Integer rowCount,@Header("wkey") String wkey); } and my getArrayList method is like public void getJoinlist(Integer lastOrderId,Integer rowCount){ showProgressDialog("Please Wait..."); final String wkey = tinyDB.getString(Constant.wkey); Log.d(CLASS_NAME, "wkey :"

HTML Checkbox automatically send POST

回眸只為那壹抹淺笑 提交于 2020-01-05 07:40:15
问题 I'm trying to collect checkbox data without adding button to submit. This is the code I have so far: <!-- Web form --> <form class="switcher-form" method="post"> <p class="setting-switch setting-switch-first"> <label for="setting1">Controle Total</label> <!-- switcher checkbox #1 --> <input type="checkbox" class="switcher" checked name="setting1" value="1" onclick="submit();"/> </p> <p class="setting-switch"> <label for="setting2">Controle Sala</label> <!-- switcher checkbox #2 --> <input