[英]POST request through php doesn't work
I've got a piece of code like this in my script 我的脚本中有一段这样的代码
$postData = http_build_query($data);
$options = array('http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded' . PHP_EOL,
'content' => $postData
));
$url = 'http://evergreens.bitrix24.ru/crm/configs/import/lead.php';
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
But the remote server 'evergreens...' responds with an error. 但是远程服务器“常绿...”响应为错误。 If I make a post request with jquery it's ok but it doesn't work with php as I need to hide auth data in the script from users.
如果我使用jquery发出发布请求,则可以,但是它不适用于php,因为我需要向用户隐藏脚本中的身份验证数据。 I suppose sending data has to be at exactly $_POST array, may be I'm wrong... Originallly the error is in russian:
我想发送数据必须精确地在$ _POST数组中,可能是我错了...最初该错误是俄语的:
{'error':'400','error_message':'Ошибка запроса'}
In english it sounds like 'Request error'
. 用英语听起来像是
'Request error'
。
Seems likeyou are posting teh data to http://evergreens.bitrix24.ru i think posting to this url might need some kind of authentication like HTTP headers or something like that. 似乎您正在将数据发布到http://evergreens.bitrix24.ru,我认为发布到此url可能需要某种身份验证,例如HTTP标头或类似的东西。 This may be needed for the website to know which user is posting the data
网站可能需要知道哪些用户正在发布数据
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.