Inbound Transmission Systems

Petals offers a number of methods of transmitting orders to the system for collection by others. The present range is provided here.

Other options might be possible so please contact us with any questions. hq@petalsnetwork.com.

Inbound Order Options

URLEncoded

Single order entered on-line

THIS VERSION NO LONGER RECOMMENDED

With this option you can send orders online with our online order form. This form is available to you 24/7 from the Relay to Relay site and conforms with the Universal Floral Order (UFO) format.

URL Encoded With this option, the information normally in a web-based form is appended to the end of the URL which calls Petals Worldwide. Only a single record at a time can be sent in this format.

The calling format is;

TESTING

http://testpin.petalsnetwork.com/wconnect/wc.isa?pbo~&ctype=34&

LIVE

http://www.petalsnetwork.com/wconnect/wc.isa?pbo~&ctype=34&

Full URL Encoded Example

This example conforms with the Petals Universal Floral Order (UFO) Format.

spaces are should be converted to + signs, data fields are separated by & and any control characters are converted to hex representations preceded by a % sign.

XML

With this option, you can send and receive orders (and shortly messages) to and from the Petals system. This option is good for the automated handling of bulk orders.

Orders are normally processed immediately on receipt at Petals (some conditions might apply to some countries and florists). The progress of orders and messaging is available on our custom bulk international order web interface.

Only a single order can be sent each transmission at this time. The calling format is; http://testpin.petalsnetwork.com/wconnect/wc.isa?pbo~&ctype=45 etc etc XML orders use the same standard Petals Universal Floral Order (UFO) format. A sample XML order might look like;

<?xml version="1.0" encoding="UTF-8"?>
<order>
<recordtype>01</recordtype>
<seller>1007</seller>
<sendid>14207</sendid>
<password>HELLO</password>
<recipient>Marilyn Test</recipient>
<surname>Test</surname>
<address>
rm 12 Test private hospital, 5 studley ave</address>
<town>Test Town</town>
<state>nsw</state>
<postalcode>3100</postalcode>
<crtyname>AUSTRALIA</crtyname>
<crtycode>AU</crtycode>
<phone>02 123456</phone>
<productid>C2</productid>
<description>arrangement include lilles roses lizzies orchids</description>
<message>as early as poss dear mary get well soon with much love from families</message>
<deldate>20100313</deldate>
<deltime>any time</deltime>
<tvalue>80</tvalue>
</order>

Example PHP code for sending orders

The following example code may assist those writing in PHP to send orders to Petals using XML. The sample code was updated 22/09/2009 to demonstrate reading the XML returned from version 45 onwards.

Please refer to the status messages for response codes

Download Example PHP

<?php

$url = 'http://testpin.petalsnetwork.com/wconnect/wc.isa?pbo~&ctype=45';

// generate a random order number
srand(time());
$random = rand(500, 10000);

// our post data is xml
$xml_data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
. "<order>"
. " <recordtype>01</recordtype>"
. " <seller>1007</seller>"
. " <sendid>$random</sendid>"
. " <password>HELLO</password>"
. " <recipient>Marilyn Test</recipient>"
. " <surname>Test</surname>"
. " <address>rm 12 Test private hospital, 5 studley ave</address>"
. " <town>Test Town</town>"
. " <state>nsw</state>"
. " <postalcode>3100</postalcode>"
. " <crtyname>AUSTRALIA</crtyname>"
. " <crtycode>AU</crtycode>"
. " <phone>02 123456</phone>"
. " <productid>C2</productid>"
. " <description>arrangement include lilles roses lizzies orchids</description>"
. " <message>as early as poss dear mary get well soon with much love from families</message>"
. " <deldate>20100313</deldate>"
. " <deltime>any time</deltime>"
. " <tvalue>80</tvalue>"
. "</order>";

//open connection
$ch = curl_init();

// set the url
curl_setopt($ch, CURLOPT_URL, $url);

// tell curl we want to do a HTTP POST
curl_setopt($ch, CURLOPT_POST, true);

// we want to capture the result in a variable
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// change the content type header to be text/xml as we aren't sending
// the data as formencoded
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));

// add the xml data to the curl request
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);

//execute post
$result = curl_exec($ch);
// see if got response and check type
if($result != false) {
$xml = simplexml_load_string($result);
if($xml) {
if($xml->type == "100") {

// sent ok
echo('Order Received OK');
}
}
} else {

// order failed at Petals end for coded reason given in variable TYPE
echo("Failed to Place Order");
}


//close connection
curl_close($ch);

?>

Example ASP code for sending orders

The following example code may assist those writing in ASP to send orders to Petals using XML.

The example code was updated 22/09/2009 to demonstrate reading the XML returned from version 45 onwards.

Please refer to the status messages for response codes

Download Example ASP

<%
dim myOrderID
myOrderID = 657646
dim xml_data, XmlDocument, httpRequest, message, txt, xmlDoc, statusNode

xml_data = "<?xml version=""1.0"" encoding=""UTF-8""?>" & chr(13)
xml_data = xml_data & "<order>" & chr(13)
xml_data = xml_data & "<recordtype>01</recordtype>" & chr(13)
xml_data = xml_data & "<seller>1995</seller>" & chr(13)
xml_data = xml_data & "<sendid>" & myOrderID & "</sendid>" & chr(13)
xml_data = xml_data & "<password>DEMO</password>" & chr(13)
xml_data = xml_data & "<recipient>" & "FULL NAME" & "</recipient>" & chr(13)
xml_data = xml_data & "<surname>" & "SURNAME" & "</surname>" & chr(13)
xml_data = xml_data & "<address>" & "TEST ADDRESS" & "</address>" & chr(13)
xml_data = xml_data & "<town>" & "TOWN" & "</town>" & chr(13)
xml_data = xml_data & "<state>"& "STATE" &"</state>" & chr(13)
xml_data = xml_data & "<postalcode>"& "2350" &"</postalcode>" & chr(13)
xml_data = xml_data & "<crtyname>Australia</crtyname>" & chr(13)
xml_data = xml_data & "<crtycode>AU</crtycode>" & chr(13)
xml_data = xml_data & "<productid>" & "C2" & "</productid>" & chr(13)
xml_data = xml_data & "<phone>" & "0404085992" & "</phone>" & chr(13)
xml_data = xml_data & "<description>"& "DESCRIPTION" &"</description>" & chr(13)
xml_data = xml_data & "<message>"& "CARD MESSAGE" &"</message>" & chr(13)
xml_data = xml_data & "<deldate>"& "20091010" &"</deldate>" & chr(13)
xml_data = xml_data & "<deltime>any time</deltime>" & chr(13)
xml_data = xml_data & "<tvalue>80</tvalue>" & chr(13)
xml_data = xml_data & "</order>" & chr(13)

'response.write xml_data

Set HttpRequest = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
HttpRequest.open "POST", "http://testpin.petalsnetwork.com/wconnect/wc.isa?pbo~&ctype=45", False

HttpRequest.setRequestHeader "Content-Type", "text/xml"
HttpRequest.setRequestHeader "Content-Length", Len(xml_data)

HttpRequest.send xml_data

If Not HttpRequest.status = 200 And Len(message) = 0 Then
message = "Error communicating with Server: " & HttpRequest.status & " - " & HttpRequest.statusText
ElseIf Err And Len(message) = 0 Then
message = "Error using Microsoft MSXML Object: " & Err.number & " - " & Err.Description
Err.clear
End If

'Get response text
txt = HttpRequest.responseText
'response.write txt & "<br>" & message

set xmlDoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmlDoc.async = false
xmlDoc.loadxml(txt)

set statusNode= xmlDoc.SelectSingleNode("status/type")

if statusNode.text = "100" then
Response.Write "success"
else
Response.Write "failed"
Response.Write statusNode.text
end if

%>

FTP - File Transfer

Protocol Petals does exchange orders with some clients via FTP and batch files.

However, we prefer in future to handle the order exchange with XML.

If you have a FTP / batch operation and want to use Petals, please contact us (hq@petalsnetwork.com ) for more discussion.

XML - future improvements discussion

This section discusses possible improvements to the Petals XML-based order management system. Items discussed here are not presently in operation. Once there is consensus among users, we will move the topic out to it own section.

Uniform Floral Order (UFO)

The UFO presently in use is shown here. Experience has suggested a couple of improvements that are open for discussion at this stage.

THERE ARE NO CHANGES UNDER DISCUSSION AT PRESENT.

Uniform Message Record

This is a new XML record type designed to exchange a single ‘thread’ of a message stream between the three parties that might be involved in an order - seller, Petals HQ and supplier.

The idea is to provide the message as data that can be automatically merged into the systems of each of the involved parties reducing the amount of manual effort required for e.g. reading and cutting and pasting emails or telephoning at busy times. The present design for this record is given here.

Feedback is welcome.

Uniform Status Record

This is a new record type whose purpose is to provide feedback on the status of an order.

A status record might be exchanged when the order is received by Petals, and again when received by the supplying florist or agent, and again when delivered to the recipient, cancelled etc etc.

Each organization involved in the order transmission could generate a relevant status record. This does mean a lot of status record exchanges but has the advantage of keeping all parties up-to-date on the progress of the order. We have now finished its specification and it is running in beta.

See here for details.

Version Information

This family of automated order exchange programs is under fairly regular revision. For your convenience, the list below identifies several of the common versions.

The principal change you will need to make to move from one version to another is to change the 'ctype' variable to the version of choice.

V23 - form based order submission of our websites.

Not normally used by others but might suit someone wanting to manually type orders into a web page.

Discuss with Petals before use.

V34 - URL encoded submission.

No longer recommended but supported for those using it. No enhancements expected. Existing users are advised to upgrade at their convenience.

V41 - early XML version.

Not recommended and no further users permitted. Existing users are advised to upgrade at their convenience.

V44 - XML version. Takes orders only.

Now superseded by V45 but will remain supported but no further enhancements to the software and no further users.

V45 - XML version presently our preferred solution.

Accepts orders with the extra fields ( 2 orders number fields and the makeup field) described in the UFO. Emails warning and error messages if problems detected with inbound orders.

Versions before this one return a HTML status message string. From this version onwards, the return from the POST to Petals is an XML Status record capable of human viewing and/or machine parsing. This version also introduces the Status XML record and the Message XML record methods for those optionally using them.

Software

See our software page for more information