php curl post巨大的字符串没有被发送

时间:2018-01-18 12:14:19

标签: php curl

将此cURL php发布请求发送到远程服务器但它无法正常工作:

# 1. Generate keystrokes using Python + Tkinter.
# 2. Save needed keycodes in the dictionary.
# 3. Use dictionary with keycodes to handle keystrokes independently from
#    operating system, language or (maybe?) keyboard model.
# This is not an elegant solution, so I think it is better to "hardcode"
# keycodes depending on the operating system.
import tkinter as tk

def keystroke(event):
    dict[event.keycode] = event.keysym  # save keycodes into the dictionary

def keyboardevent(str):
    # Code that simulated 'key' being pressed on keyboard
    temp.after(10, lambda: temp.event_generate('<Key-{}>'.format(str)))

temp = tk.Tk()
temp.withdraw()  # remove the window from the screen (without destroying it)
temp.bind('<Key>', keystroke)
dict = {}  # dictionary of the needed keycodes
keyboardevent('w')  # generate needed keyboard events
keyboardevent('s')
keyboardevent('a')
keyboardevent('d')
temp.after(20, temp.destroy)  # this is not needed anymore
temp.mainloop()

# Start your code here
def keys_handler(event):
    if event.keycode in dict:
        print(dict[event.keycode])

root = tk.Tk()
root.focus_force()
root.bind('<Key>', keys_handler)
root.mainloop()

重点是它没有给我任何错误(error_log和try (PrintWriter writer = new PrintWriter(file)) { writer.println(text1); writer.println(text2); } )。只是它超过了最大时间限制(30秒),并且如果我将此时间限制设置为300仍然是相同的结果。

我正在使用PHP7而#$long_value equals a 1400000 bytes string $array = array( 'value' => 1, 'long_value' => $long_value, ); $array = http_build_query($array); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://domain_name.com/url/to/script.php'); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $array); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); curl_close($ch); 是8MB所以我的问题是:

如何解决此问题?

它与作为curl_error($ch)传递的字符串的长度有关吗?

0 个答案:

没有答案
相关问题