Hello Romain,

       Thanks for your suggestion, it looks interesting.

       I will have a try.

       Regards,

JoJo

2010/4/9 romain godefroy <[email protected]>

> adapted from this about asynchronous http post :
> http://petewarden.typepad.com/searchbrowser/2008/06/how-to-post-an.html
>
> <?php
> function curl_post_async($url, $params = null)
> {
>    if($params) {
>      foreach ($params as $key => &$val) {
>        if (is_array($val)) $val = implode(',', $val);
>          $post_params[] = $key.'='.urlencode($val);
>      }
>      if($post_params) $post_string = implode('&', $post_params);
>    }
>
>    $parts=parse_url($url);
>
>    $fp = fsockopen($parts['host'],
>        isset($parts['port'])?$parts['port']:80,
>        $errno, $errstr, 30);
>
>    if($fp) {
>      $out = "POST ".$parts['path']." HTTP/1.1\r\n";
>      $out.= "Host: ".$parts['host']."\r\n";
>      $out.= "Content-Type: application/x-www-form-urlencoded\r\n";
>      $out.= "Content-Length: ".strlen($post_string)."\r\n";
>      $out.= "Connection: Close\r\n\r\n";
>      if (isset($post_string)) $out.= $post_string;
>
>      fwrite($fp, $out);
>      fclose($fp);
>
>      return true;
>    } else {
>      return false;
>    }
> }
>
> $url = 'http://test/action.php';
> $params = array();
>
> $asynchronous_call = curl_post_async($url, $params);
> $asynchronous_call = curl_post_async('http://www.google.com');
> ?>
>
> you can call another symfony action with that function.
>
>
> On 8 avr, 18:50, Dong YANG <[email protected]> wrote:
> > Hello everyone,
> >
> >       I have a question about event dispatcher. Is that possible to call
> an
> > event dispatcher on asynchronous mode.
> >
> >       Because in my function i need to launch an event which takes some
> > seconds, so i just want to continue the rest of the function instead of
> > waiting the end of event function. Is that possible in symfony event
> > dispatcher?
> >
> >       Any suggestion is welcomed.
> >
> >      Thanks and Regards,
> >
> > JoJo
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to