Hi all,
Im trying to make a function for creating a package label via something called pacsoft. It only accepts XML and the below code is take from a straight up php example.
The curl part should work as is - but how do i write the below xml in my controller so that it becomes $xml ?
$ch = curl_init("https://www.pacsoftonline.com/ufoweb/order?user=".$pacsoft_user."&pin=".$pacsoft_pass."&type=xml&session=po_DK");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
<?xml version="1.0" encoding="UTF-8"?>
<pacsoftonline>
<receiver rcvid="">
<val n="name">-</val>
<val n="address1">-</val>
<val n="address2"></val>
<val n="zipcode">-</val>
<val n="city">-</val>
<val n="country">DK</val>
<val n="contact"></val>
<val n="email"></val>
<val n="sms"></val>
</receiver>
</pacsoftonline>
After advise on irc i did the following:
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<pacsoftonline>
<receiver rcvid="">
<val n="name">-</val>
<val n="address1">-</val>
<val n="address2"></val>
<val n="zipcode">-</val>
<val n="city">-</val>
<val n="country">DK</val>
<val n="contact"></val>
<val n="email"></val>
<val n="sms"></val>
</receiver>
</pacsoftonline>
';
and that worked :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community