2013-07-16 79 views
1

我需要在我的終端上執行以下信息。任何人都可以請告訴我如何寫在捲曲?如何寫捲曲文章

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 

回答

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是獲取此信息的BOOLEAN值。

如果您需要更多的幫助,我會很高興:)

+0

非常感謝!我基本上必須通過本網站http://wiki.shopgate.com/Plugin_API_authentication中提到的使用某人的api進行身份驗證。 因此,這是請求的標題。 我到現在爲止可以把它翻譯成curl _curl -v -X POST -d api.php http://shopgate/api.php -H「User-Agent:Shopgate」-H「Host :xxxx「-H」Accept */*「-H」X-Shopgate-Auth-User:xxxxxxxxxxxx「-H」X-Shopgate-Auth-Tokenclear:xxxxxxxxxxxxxx「-H」Content-Length:80「-H」Content -Type:application/x-www-form-urlencoded「_ 但它仍然無效! – user2587123

+0

@ user2587123好吧,您的問題的答案立即在您參考標題爲「測試身份驗證」的頁面上。 – Black0CodeR

1

curl有--header選項。 man curl有詳細信息。

+0

謝謝你,但我仍然不知道如何這個頭轉換成捲曲的語法在終端上。這是我到現在爲止 _curl -v -X POST -d api.php shopgate/api.php -H「User-Agent:Shopgate」-H「Host:xxxx」-H「Accept */* 「-H」X-Shopgate-Auth-User:xxxxxxxxxxxx「-H」X-Shopgate-Auth-Tokenclear:xxxxxxxxxxxxxx「-H」Content-Length:80「-H」Content-Type:application/x-www-form -urlencoded「_ – user2587123

+0

不應該是'-H」接受:*/*「' – user2587106