title: Using Shopify API to create product in PHP
body: <p>Thanks a lot for your solutions. I am using Shopify API along with PHP CURL POST Method to create product. The following is the code and output. </p>
  
  <pre><code>$products_array = array(
      "product"=&gt;array(
          'title'=&gt;'',
          "title"=&gt; "Burton Custom Freestlye 151",
          "body_html"=&gt; "&lt;strong&gt;Good snowboard!&lt;/strong&gt;",
          "vendor"=&gt; "Burton",
          "product_type"=&gt; "Snowboard",
          "published"=&gt; false ,
          "variants"=&gt;array(
                          array(
                          "sku"=&gt;"t_009",
                          "price"=&gt;20.00,
                          "grams"=&gt;200,
                          "taxable"=&gt;false,
                          )
          )
      )
  );
  echo json_encode($products_array);
  echo "&lt;br /&gt;";
  $url = "https://apikey:password@hostname/admin/products.json";
  
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json'));
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_VERBOSE, 0);
  curl_setopt($curl, CURLOPT_HEADER, 1);
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
  curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($products_array));
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  $response = curl_exec ($curl);
  curl_close ($curl);
  echo "&lt;pre&gt;";
  print_r($response); 
  </code></pre>
  
  <p>Where I am using my credentials given in $url part. I am getting following error </p>
  
  <pre><code>{"product":{"title":"Burton Custom Freestlye 151","body_html":"Good snowboard!&lt;\/strong&gt;","vendor":"Burton","product_type":"Snowboard","published":false,"variants":[{"sku":"t_009","price":20,"grams":200,"taxable":false}]}}
  
  HTTP/1.1 400 Bad Request
  Server: nginx
  Date: Thu, 05 Feb 2015 07:28:58 GMT
  Content-Type: application/json; charset=utf-8
  Transfer-Encoding: chunked
  Connection: keep-alive
  X-Sorting-Hat-PodId: 0
  X-Sorting-Hat-ShopId: 7628323
  X-Sorting-Hat-PodId-Cached: 0
  X-Sorting-Hat-ShopId-Cached: 0
  Status: 400 Bad Request
  X-XSS-Protection: 1; mode=block; report=/xss-report/2dfd1c1e-6c9c-4024-a9bf-f3f6b177eb17?source%5Baction%5D=create&amp;source%5Bcontroller%5D=admin%2Fproducts&amp;source%5Bsection%5D=admin
  X-Content-Type-Options: nosniff
  X-ShopId: 7628323
  X-ShardId: 0
  X-Shopify-Shop-Api-Call-Limit: 1/40
  HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40
  X-Stats-UserId: 0
  X-Stats-ApiClientId: 619259
  X-Stats-ApiPermissionId: 9949639
  X-Request-Id: 2dfd1c1e-6c9c-4024-a9bf-f3f6b177eb17
  X-Kafka-Logged: 1
  
  {"errors":{"product":"Required parameter missing or invalid"}}
  </code></pre>