Skip to content

Instantly share code, notes, and snippets.

@coderberry
Created December 15, 2009 00:01
Show Gist options
  • Select an option

  • Save coderberry/256583 to your computer and use it in GitHub Desktop.

Select an option

Save coderberry/256583 to your computer and use it in GitHub Desktop.
<?php
require_once "HTTP/Request.php";
$xml = "
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<order>
<company-id>1</company-id>
<shipping-profile>t1</shipping-profile>
<shipping-full-name>John Doe</shipping-full-name>
<shipping-care-of/>
<shipping-address-1>123 Easy St</shipping-address-1>
<shipping-address-2/>
<shipping-city>Eau Claire</shipping-city>
<shipping-state>WI</shipping-state>
<shipping-zip>77593</shipping-zip>
<shipping-country>US</shipping-country>
<items>
<item>
<inventory-item-id>1</inventory-item-id>
<quantity>1</quantity>
</item>
</items>
</order>";
$req =& new HTTP_Request("http://POST_URL_HERE/api/create_custom_order");
$req->addHeader('Referer', 'http://www.my_url_here.com');
$req->addHeader('Content-Type', 'application/xml');
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$req->setBody($xml);
$response = $req->sendRequest();
if (PEAR::isError($response)) {
echo $response->getMessage();
} else {
echo $req->getResponseBody();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment