title: Change Output of PHP Script to use POST Method
body: <p>Bear with my inexperience here, but can anyone point me in the right direction for how I can change the PHP script below to output each variable that is parsed from the XML file (title, link, description, etc) as a POST method instead of just to an HTML page?</p>
  
  <pre><code>&lt;?php
  $html = "";
  $url = "http://api.brightcove.com/services/library?command=search_videos&amp;any=tag:SMGV&amp;output=mrss&amp;media_delivery=http&amp;sort_by=CREATION_DATE:DESC&amp;token= // this is where the API token goes";
  $xml = simplexml_load_file($url);
  $namespaces = $xml-&gt;getNamespaces(true); // get namespaces
  
  for($i = 0; $i &lt; 80; $i++){
    $title = $xml-&gt;channel-&gt;item[$i]-&gt;video;
    $link = $xml-&gt;channel-&gt;item[$i]-&gt;link;
    $title = $xml-&gt;channel-&gt;item[$i]-&gt;title;
    $pubDate = $xml-&gt;channel-&gt;item[$i]-&gt;pubDate;
    $description = $xml-&gt;channel-&gt;item[$i]-&gt;description;
    $titleid = $xml-&gt;channel-&gt;item[$i]-&gt;children($namespaces['bc'])-&gt;titleid;
    $html .= "&lt;h3&gt;$title&lt;/h3&gt;$description&lt;p&gt;$pubDate&lt;p&gt;$link&lt;p&gt;Video ID: $titleid&lt;p&gt;
      &lt;iframe width='480' height='270' src='http://link.brightcove.com/services/player/bcpid3742068445001?bckey=AQ~~,AAAABvaL8JE~,ufBHq_I6FnyLyOQ_A4z2-khuauywyA6P&amp;bctid=$titleid&amp;autoStart=false' frameborder='0'&gt;&lt;/iframe&gt;&lt;hr/&gt;";/* this embed code is from the youtube iframe embed code format but is actually using the embedded Ooyala player embedded on the Campus Insiders page. I replaced any specific guid (aka video ID) numbers with the "$guid" variable while keeping the Campus Insider Ooyala publisher ID, "eb3......fad" */
  }
  echo $html;
  ?&gt;
  </code></pre>
  
  <p>@V.Radev Here's another PHP script using cURL that I think will work with the API I'm trying to send data to: </p>
  
  <pre><code>&lt;?PHP
    $url = 'http://api.brightcove.com/services/post';
  
    //open connection
    $ch = curl_init($url);
  
    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_POST, 1);
    curl_setopt($ch,CURLOPT_POSTFIELDS, '$title,$descripton,$url' . stripslashes($_POST['$title,$description,$url']));
    curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
  
    // Enable for Charles debugging
    //curl_setopt($ch,CURLOPT_PROXY, '127.0.0.1:8888'); 
  
    $result = curl_exec($ch);
    curl_close($ch);
  
    print $result;
  ?&gt;
  </code></pre>
  
  <p>My question is, how can I pass the variables from my feed parsing script (title, description, URL) to this new script? </p>
  
  <p>I have this code from Brightcove, can I just output the variables from my parser script and send to this PHP script so that the data goes to the API? </p>
  
  <pre><code>&lt;?php
  
    // This code example uses the PHP Media API wrapper
    // For the PHP Media API wrapper, visit http://docs.brightcove.com/en/video-cloud/open-source/index.html
  
    // Include the BCMAPI Wrapper
    require('bc-mapi.php');
  
    // Instantiate the class, passing it our Brightcove API tokens (read, then write)
    $bc = new BCMAPI(
      '[[READ_TOKEN]]',
      '[[WRITE_TOKEN]]'
    );
  
    // Create an array of meta data from our form fields
    $metaData = array(
      'name' =&gt; $_POST['bcVideoName'],
      'shortDescription' =&gt; $_POST['bcShortDescription']
    );
  
    // Move the file out of 'tmp', or rename
    rename($_FILES['videoFile']['tmp_name'], '/tmp/' . $_FILES['videoFile']['name']);
    $file = '/tmp/' . $_FILES['videoFile']['name'];
  
    // Create a try/catch
    try {
      // Upload the video and save the video ID
      $id = $bc-&gt;createMedia('video', $file, $metaData);
            echo 'New video id: ';
            echo $id;
    } catch(Exception $error) {
      // Handle our error
      echo $error;
      die();
    }
  ?&gt;
  </code></pre>