Re: Can PHP do this? -- w/o using event handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, March 3, 2008 1:57 am, Louie Miranda wrote:
> Could PHP do..
>
> 1. Connect and send a parameter to a remote host
> 2. Wait for the host to reply -- not using event handler
> 3. Send XML data to the host

<?php
$xml = file_get_contents("/path/to/file.xml");
$s = fsockopen("remote host here");
$reply = fgets($s, 1000000);
$bytes = fputs($s, $xml);
if ($bytes != ($len = strlen($xml))){
  error_log("Only sent $bytes of $len bytes!");
}
?>

You'll need about 3X as much code for proper error checking, but
that's about it, really...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux