我想在构建之后发送一个url。到目前为止这是代码。
$producten = '';
foreach ($orders as $product) {
$producten .= "&articlecode=" . $product['productTitle'] . "&color=NAVY&size=" . $product['variantTitle'] . "&qty=" . $product['quantityOrdered'] . "&price=" . number_format($product['priceIncl'], 2) * 100;
}
$url= file_get_contents('http://api.softwear.nl/scripts/foxisapi.dll/sww1.wreq1.mpx?sendorder&token=' . $swToken . '
&custnum=' . $custNum . '&email=' . $email . '&title=' . $gender . '&firstname=' . $firstname . '&middlename=' . $middlename . '&lastname=' . $lastname . '
&street=' . $addressBillingName . '&housenum=' . $addressBillingNumber . '&zipcode=' . $addressBillingZipcode . '&city=' . $addressBillingCity . '
&countrycode=' . $code . '&shipping=' . $shipmentTrim . '&discount=' . $discountTrim . '&refid=' . $referralId . $producten++);
echo $url;
如果我用标题(位置)来做它很好,但我认为它不是解决这个问题的方法。
答案 0 :(得分:0)
我明白了。以下是具有相同问题的人的代码。
/* cURL Resource */
$ch = curl_init();
/* Set URL */
curl_setopt($ch, CURLOPT_URL, 'http://api.softwear.nl/scripts/foxisapi.dll/sww1.wreq1.mpx?sendorder&token=' . $swToken . '
&custnum=' . $custNum . '&email=' . $email . '&title=' . $gender . '&firstname=' . $firstname . '&middlename=' . $middlename . '&lastname=' . $lastname . '
&street=' . $addressBillingName . '&housenum=' . $addressBillingNumber . '&zipcode=' . $addressBillingZipcode . '&city=' . $addressBillingCity . '
&countrycode=' . $code . '&shipping=' . $shipmentTrim . '&discount=' . $discountTrim . '&refid=' . $referralId . $producten++);
/* Tell cURL to return the output */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
/* Tell cURL NOT to return the headers */
curl_setopt($ch, CURLOPT_HEADER, false);
/* Execute cURL, Return Data */
$data = curl_exec($ch);
/* Check HTTP Code */
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
/* Close cURL Resource */
curl_close($ch);
/* 200 Response! */
if ($status == 200) {
/* Debug */
var_dump($data);
} else {
/* Debug */
var_dump($data);
var_dump($status);
}