Looking for PHP solution for sending tracking/fulfillment info

New Member
1 0 0

I have searched this community and a lot of Googling and have not found a working solution for what I need so I could use your help please.  Due to my customer's requirements, I need a PHP based solution for retrieving orders from Shopify and sending tracking numbers to complete the order and send the email.  We are using an external 3rd party fulfillment company. I have the retrieving orders part working so the basics of authorization, etc. are handled.  It was done using PHP CURL GET.  But trying to use a similar CURL POST is not working as I need. 


What I get as a response starts with "HTTP/1.1 303" and ends with "You are being redirected."


Here is what I am using minus the store specific parts.  I have tried using tracking_numbers and tracking_number with same result.

$fulfillment = array(
"location_id" => 905684977,
"tracking_numbers" => '123456789',
"tracking_company" => 'FedEx',
"tracking_urls" => array(
"notify_customer" => true
$data_string = json_encode(array('fulfillment' => $fulfillment)); //json encode the array
$create_fulfillment_url = https://xxxxxxx:xxxxxxx@My-store.myshopify.com/admin/api/2020-01/orders/#111111111111/fulfillments.json
// Configure cURL
$curl = curl_init($create_fulfillment_url);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,$data_string); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 3);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    // Setup headers
    $request_headers[] = "Content-type: text/plain";
    curl_setopt($curl, CURLOPT_HTTPHEADER, $request_headers);
    // Send request to Shopify and capture any errors
    $response = curl_exec($curl);
    $error_number = curl_errno($curl);
    $error_message = curl_error($curl);
    // Close cURL to be nice
    // Return an error is cURL has a problem
    if ($error_number) {
        echo '$error_message = '.$error_message;
    } else {  
        // No error
       echo 'response = '.$response;
Any help is really appreciated.
Thank you.
New Member
2 0 0
"notify_customer" => true
"tracking_urls" =>[