title: how to post a comment with instagram API on PHP
body: <p>i want to ask something about instagram API. i have try this API and get some problem about "Comment" section.</p>
  
  <p>how can i post i comment on instagram API with php curl? on API documentation clearly explain that i must use this code :</p>
  
  <pre><code>curl -F 'access_token=ACCESS-TOKEN' \
   -F 'text=This+is+my+comment' \
   https://api.instagram.com/v1/media/{media-id}/comments
  </code></pre>
  
  <p>but, i have no idea or a sample for execute this with php. please teach me or give me a sample for using php curl.</p>
  
  <p>any help would be appreciate, thankyou very much :)</p>
  
  <p>update code :</p>
  
  <pre><code>&lt;form method="post" action=''&gt;
  &lt;p&gt;&lt;em&gt;Media id&lt;/em&gt; &lt;input type="text" name="tag" placeholder="Awesome"/&gt;&lt;br&gt;
  &lt;input type="submit" value="Ok" /&gt;&lt;/p&gt;
  &lt;/form&gt;
  
  &lt;?php
  
  
    if(!empty($_POST['tag'])){
  
  
      $url = 'https://api.instagram.com/v1/media/1285310544400585898_1388393123/comments';
  
  try {
  $curl_connection = curl_init($url);
  curl_setopt($curl_connection, CURLOPT_POST, true);
  curl_setopt($curl_connection, CURLOPT_POSTFIELDS, http_build_query(array('access_token' =&gt; 'myaccesstoken','text'=&gt;' test')));
  curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
  
  //Data are stored in $data
  $data = json_decode(curl_exec($curl_connection), true);
  print_r($data);
  curl_close($curl_connection);
  } catch(Exception $e) {
  return $e-&gt;getMessage();
  }
  
  }
  ?&gt;
  </code></pre>