Post 如何用curl写文章

Post 如何用curl写文章,post,curl,Post,Curl,我需要在我的终端上执行以下信息。谁能告诉我怎么用卷曲写这个吗 POST /shopgate/api.php HTTP/1.1 User-Agent: Shopgate Host: ihrshop.com Accept: */* X-Shopgate-Auth-User: 12345-1329146130 X-Shopgate-Auth-Token: 07c573bcaf4e1b4669c3dd23175d78fcfab4e5b4

我需要在我的终端上执行以下信息。谁能告诉我怎么用卷曲写这个吗

POST /shopgate/api.php HTTP/1.1         
User-Agent: Shopgate     
Host: ihrshop.com     
Accept: */*     
X-Shopgate-Auth-User: 12345-1329146130     
X-Shopgate-Auth-Token: 07c573bcaf4e1b4669c3dd23175d78fcfab4e5b4     
Content-Length: 80     
Content-Type: application/x-www-form-urlencoded
curl有一个
--header
选项。
man curl
有详细信息。

curl有一个
--标题
选项。
man curl
有详细信息。

你的问题不太清楚。但是,我给你提供了一些很好的答案,可能会对你有所帮助

如果要通过
POST
发送数据,则可以使用此选项

curl_setopt($ch, CURLOPT_POST ,1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
$post
将是您要发送的字段

如果你想要标题的信息

POST /shopgate/api.php HTTP/1.1         
User-Agent: Shopgate     
Host: ihrshop.com     
Accept: */*     
X-Shopgate-Auth-User: 12345-1329146130     
X-Shopgate-Auth-Token: 07c573bcaf4e1b4669c3dd23175d78fcfab4e5b4     
Content-Length: 80     
Content-Type: application/x-www-form-urlencoded
那你最好说出来

curl_setopt($curl, CURLOPT_HEADER, $header);
$header
是用于获取或不获取此信息的布尔值


如果你需要更多的帮助,我很乐意:)

你的问题不太清楚。但是,我给你提供了一些很好的答案,可能会对你有所帮助

如果要通过
POST
发送数据,则可以使用此选项

curl_setopt($ch, CURLOPT_POST ,1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
$post
将是您要发送的字段

如果你想要标题的信息

POST /shopgate/api.php HTTP/1.1         
User-Agent: Shopgate     
Host: ihrshop.com     
Accept: */*     
X-Shopgate-Auth-User: 12345-1329146130     
X-Shopgate-Auth-Token: 07c573bcaf4e1b4669c3dd23175d78fcfab4e5b4     
Content-Length: 80     
Content-Type: application/x-www-form-urlencoded
那你最好说出来

curl_setopt($curl, CURLOPT_HEADER, $header);
$header
是用于获取或不获取此信息的布尔值


如果您需要更多帮助,我会很高兴:)

非常感谢!我基本上必须验证自己,才能使用本网站中提到的某人的api。因此,这是请求的标头。到目前为止,我能想到的是将它这样翻译成curl curl-v-X POST-dapi.php-H“User-Agent:Shopgate”-H“Host:xxxx”-H“Accept*/*”-H“X-Shopgate-Auth-User:xxxxxxxxxxxxxxx”-H“X-Shopgate-Auth-Tokenclear:xxxxxxxxxxxxxxxxxxxxx”-“内容长度:80”-”内容类型:application/X-www-form-urlencoded”但它仍然不起作用@user2587123好的,您的问题的答案就在您提到的“测试身份验证”标题下的页面上。非常感谢!我基本上必须验证自己,才能使用本网站中提到的某人的api。因此,这是请求的标头。到目前为止,我能想到的是将它这样翻译成curl curl-v-X POST-dapi.php-H“User-Agent:Shopgate”-H“Host:xxxx”-H“Accept*/*”-H“X-Shopgate-Auth-User:xxxxxxxxxxxxxxx”-H“X-Shopgate-Auth-Tokenclear:xxxxxxxxxxxxxxxxxxxxx”-“内容长度:80”-”内容类型:application/X-www-form-urlencoded”但它仍然不起作用@user2587123好的,您的问题的答案就在您提到的标题“测试身份验证”下的页面上。谢谢您,但我仍然不知道如何在终端上将此标题转换为curl语法。这就是我到目前为止提出的curl-v-X POST-dapi.php shopgate/api.php-H“用户代理:shopgate”-H“主机:xxxx”-H“接受*/*”-H“X-shopgate-Auth-User:xxxxxxxxxxxxxxx”-H“X-shopgate-Auth-Tokenclear:xxxxxxxxxxxxxxxxxxxxx”-”内容长度:80”-内容类型:application/X-www-form-urlencoded“它不应该是
-H”接受://*”
谢谢,但我仍然不知道如何在终端上将此标题转换为curl语法。这就是我到目前为止提出的curl-v-X POST-dapi.php shopgate/api.php-H“用户代理:shopgate”-H“主机:xxxx”-H“接受*/*”-H“X-shopgate-Auth-User:xxxxxxxxxxxxxxx”-H“X-shopgate-Auth-Tokenclear:xxxxxxxxxxxxxxxxxxxxx”-”内容长度:80”-内容类型:application/X-www-form-urlencoded“它不应该是
-H”接受://*”