Execute Curl Statement in PHP

Omicans

I am working in bigcommerce and I need something done for which Bigcommerce has provided the code in curl format...I do not know curl well...Can you tell me how can I execute the following code in php??

curl --request POST \
-u "admin:key" \
-H "Content-Type: application/json" \
-d '{"order_address_id":15,"tracking_number":"123-123-123","items":[{"order_product_id":15,"quantity":1}]}' \
https://store/api/v2/orders/114/shipments.json

Any help would be highly appreciated...

Barmar
$ch = curl_init('https://store/api/v2/orders/114/shipments.json');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD, 'admin:key');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, 
    json_encode(array('order_address_id' => 15,
                      'tracking_number' => '123-123-123',
                      'items' => array(
                            array('order_product_id' => 15, 'quantity' => 1)
                        )
                     )));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事