1

我需要在我的终端上执行以下信息。谁能告诉我如何用 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     
Content-Length: 80     
Content-Type: application/x-www-form-urlencoded
4

2 回答 2

1

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

于 2013-07-16T11:40:02.507 回答
0

你的问题不是很清楚。但是,我正在为您提供一些可能对您有所帮助的好答案。

如果你想通过 发送数据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是否获取此信息的布尔值。

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

于 2013-07-16T12:35:55.700 回答