rez_request.php 867 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. if ( !defined('SLOODLE_MESSAGE_QUEUE_TASK') || !SLOODLE_MESSAGE_QUEUE_TASK) {
  3. echo 'This task should be run by the sloodled daemon';
  4. exit;
  5. }
  6. // $url and $body should already have been defined.
  7. $ch = curl_init(); // initialize curl handle
  8. curl_setopt($ch, CURLOPT_URL, $address); // set url to post to
  9. curl_setopt($ch, CURLOPT_FAILONERROR,0);
  10. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
  11. curl_setopt($ch, CURLOPT_TIMEOUT, 10); // times out after 4s
  12. curl_setopt($ch, CURLOPT_POST, 1); // set POST method
  13. curl_setopt($ch, CURLOPT_POSTFIELDS,$body); // add POST fields
  14. /*
  15. if ($proxy = $this->httpProxyURL()) {
  16. curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
  17. curl_setopt($ch, CURLOPT_PROXY, $this->httpProxyURL() );
  18. }
  19. */
  20. $result = curl_exec($ch); // run the whole process
  21. $info = curl_getinfo($ch);
  22. curl_close($ch);
  23. ?>