fork(1) download
  1. <?php
  2.  
  3. // your code goes here
  4. $str = 'Correct parameters and objects received raw message: {"message":{"message":"hi","chatBotID":6,"timestamp":1407393907},"user":{"firstName":"Tugger","lastName":"Sufani","gender":"m","externalID":"abc-639184572"}} apiSecret: 9HBkibOphng7w4p1ZdiiVJgzRI4kpD4Q Do the following two match? a702fc336f49b099764d35a548dd110fac2067bcd14a438676e4d579d70b6afc a702fc336f49b099764d35a548dd110fac2067bcd14a438676e4d579d70b6afc CORRECT MATCH! Array ( [message] => Array ( [message] => hi [chatBotID] => 6 [timestamp] => 1407393907 )';
  5. $str .= '[user] => Array';
  6. $str .= ' (';
  7. $str .= ' [firstName] => Tugger';
  8. $str .= ' [lastName] => Sufani';
  9. $str .= ' [gender] => m';
  10. $str .= ' [externalID] => abc-639184572';
  11. $str .= ' )';
  12. $str .= ') sent on Thu, 07 Aug 2014 2:45:07 am 6 seconds ago. (limit is 300) {"success":1,"errorMessage":"","message":{"chatBotName":"Desti","chatBotID":"6","message":"Yes, Tugger, I\'ve heard that one before.","emotion":"normal"}}';
  13. preg_match('/(?<=success).*"message":"(.*?)"/', $str , $matches);
  14. echo $matches[1];
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Yes, Tugger, I've heard that one before.