title: OAuthException: (#100) Invalid parameter
body: <p>I've been battling this for a day or so and I cannot find out where the error is.
  I'm building a website for a friend who throws this big party once or twice a month. I want him to be able to create an event on the website and send this event to facebook using the fb php sdk api. </p>
  
  <p>I got things working as far as creating the event on the website itself. I got creating a event using the php sdk working as wel. However combining these two is where the trouble starts. Theoretically when I want to send the event to facebook I use the event id on  the website database to gather the info, insert it into variables, then send those variables via array to the api call after witch the facebook event should be created. I am however getting a <code>" OAuthException: (#100) Invalid parameter "</code> error.</p>
  
  <p>Taking in consideration that conecting to fb and getting the acces token is working correctly and i'm retreiving the correct info from the database this is my code:</p>
  
  <pre><code>// - image upload
      $createEventCover = http://www.mywebsite.com/flyer/flyer.jpg
      $createEvent[basename($createEventCover)] = "@".realpath($createEventCover); 
  
  
  //  - textual data
  
      $createEvent = array(
          'access_token' =&gt; $accessToken,
          'name' =&gt; $createEventName,
          'start_time' =&gt; $createEventStartTime,
          'end_time' =&gt; $createEventEndTime,
          'description' =&gt; $createEventDescription,
          'location_id' =&gt; $createEventLocation_id,
          'privacy_type' =&gt; $createEventPrivacy_type
      );
  
  // connect with api and create event.
  
  try {
      $eventCreate = $FaceBook -&gt; api("/me/events", "post", $createEvent);
      $facebookEventId = $eventCreate['id'];
  
      $cover['cover_url']  = $createEventCover;
      $eventUpdate = $facebook-&gt;api( "/" . $eventCreate['id'], "post", $cover );      
  
      //$eventUpdate = $FaceBook -&gt; api( "/".$facebookEventId, "post", $createEventCover );       
      echo "&lt;script&gt;window.open('https://www.facebook.com/events/".$facebookEventId."/','_blank')&lt;/script&gt;\n";
  
  } catch( FacebookApiException $e){
      echo "//event creation error\n";
      echo "&lt;br /&gt;\n";    
      echo "&lt;br /&gt;".$e."&lt;br /&gt;\n";
  } 
  </code></pre>
  
  <p>Before I send the info to the array I echo everything so I know that I have the correct data beeing sent to correct place ans all seems to match. When I fill the array with text data instead of the php variables eg <code>"name" => "testevent"</code> instead of <code>"name" => $testevent,</code> the event gets created. as soon as I use the "name" => $testevent, instead of the <code>"name" => "testevent",</code> I get the error. </p>
  
  <p>I've already devoured google and ate half of stacoverflow to no avail. 
  can someone help me with this?  </p>
  
  <p>kind regards      </p>
  
  <p>as per request of @CBroe. I have a print_r of $createEvent:</p>
  
  <pre><code>Array
  (
      [access_token] =&gt; *removed*
      [name] =&gt; testevent
      [start_time] =&gt; DateTime Object
      (
          [date] =&gt; 2015-05-19 23:30:00
          [timezone_type] =&gt; 3
          [timezone] =&gt; Europe/Berlin
      )
  
  [end_time] =&gt; DateTime Object
      (
          [date] =&gt; 2015-05-19 04:00:00
          [timezone_type] =&gt; 3
          [timezone] =&gt; Europe/Berlin
      )
  
  [description] =&gt; Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. 
  [location_id] =&gt; 260864353982110
  [privacy_type] =&gt; SECRET
  )
  </code></pre>
  
  <p>this is when the event creation now fails with a error: 
  "OAuthException: (#100) Param event_info-start_time must be a valid time"</p>
  
  <p>Mind that this only happens when I insert the times via a variable. Once I replace the variables by a text date <code>2015-05-19T23:30:00+0200</code> the event get's created regulaarly I am converting the date to ISO8601 using </p>
  
  <pre><code>$FBcreateEventStartTime = new DateTime($createEventStartTime); 
  $FBcreateEventStartTime -&gt; format(DateTime::ISO8601);
  </code></pre>
  
  <p>with the same for endtime and in the array I have shown in the innitial code I have of course replaced </p>
  
  <pre><code>'start_time' =&gt; $createEventStartTime,
  'end_time' =&gt; $createEventEndTime,
  </code></pre>
  
  <p>by </p>
  
  <pre><code>'start_time' =&gt; $FBcreateEventStartTime,
  'end_time' =&gt; $FBcreateEventEndTime,
  </code></pre>