php - Why curl function is returning Resource id #4? -


i trying post form in json format using curl launch 27 create booking. json data is:

  {"booking":{   "id":55,   "user_id":5,   "service_date":"2015-08-15t13:00",   "services":[{     "id":1,     "extras":[{       "extra_id":1,       "quantity":1     }],     "pricing_parameters":[{       "pricing_parameter_id":1,       "quantity":1     }],     "service_maids":1,     "service_hours":1   },{     "id":2,     "extras":[],     "pricing_parameters":[],     "service_maids":1,     "service_hours":2   }],   "frequency_id":1,   "address":"595 market st",   "city":"san francisco",   "state":"ca",   "zip":"94105",   "phone":"462-485-0790",   "price":"202.0",   "final_price":"202.0",   "completed":false,   "payment_method":"stripe",   "active":true,   "discount_code":null,   "customer_comments":null,   "sms_notifications":false,   "flexibility":0,   "custom_fields":{     "custom_text":"text",     "custom_dropdown":{"values":"1"},     "custom_radio":{"values":"2"}   } }} 

and curl function is:

  function curl_post($url,$postdata){     $postdata = json_encode($postdata);     if(!isset($timeout))         $timeout=30;     $curl = curl_init();      if(isset($referer)){         curl_setopt ($curl, curlopt_referer, $referer);     }     curl_setopt ($curl, curlopt_url, $url);     curl_setopt ($curl, curlopt_timeout, $timeout);     curl_setopt ($curl, curlopt_useragent, 'mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; .net clr 1.1.4322)');     curl_setopt ($curl, curlopt_header, false);     curl_setopt ($curl, curlopt_returntransfer, true);     curl_setopt ($curl, curlopt_ssl_verifypeer, false);     curl_setopt ($curl, curlopt_ssl_verifyhost, false);     curl_setopt ($curl, curlopt_post, true);     curl_setopt ($curl, curlopt_postfields, $postdata);     curl_setopt ($curl, curlopt_httpheader,         array('x-api-key: my_test_api_key',         "content-type: application/json",         "accept: application/launch27.v2"));     $html = curl_exec ($curl);     curl_close ($curl);     return $html; } 

here given json sent $postdata , $url=https://acme-sandbox.l27.co/api/bookings returns me resourse id #4... totally confused going on. following launch 27's documentation https://bitbucket.org/awoo23/api-2.0/wiki/create_booking.

i have searched couldn't find sufficient criteria resolve this. can please me.


Comments