Dear Sirs, I am trying to post xml file to http address but no result. I saw your script at the below but I can not understand How can send file? Can you help
Best Regards "Mincu Alexandru" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > yes you can connect to the server from your PHP script and send a post > request .. here is a function that would help: > > --- PHP -- > > function http_post($server, $port, $url, $vars) { > // example: > // http_post( > // "www.fat.com", > // 80, > // "/weightloss.pl", > // array("name" => "obese bob", "age" => "20") > // ); > > $urlencoded = ""; > while (list($key,$value) = each($vars)) > $urlencoded.= urlencode($key) . "=" . urlencode($value) . "&"; > $urlencoded = substr($urlencoded,0,-1); > $content_length = strlen($urlencoded); > $headers = "POST $url HTTP/1.1 > Accept: text/plain, text/html, text/xml, image/gif, image/jpeg, > image/png, image/bmp > Accept-Charset: UTF-8 > Accept-Language: en > Content-Length: $content_length > Cache-Control: no-cache > Content-Type: application/x-www-form-urlencoded > Host: $server > User-Agent: Panasonic-GAD67/1.0 UP.Browser/5.0.3.5 (GUI) > Connection: Keep-Alive > > "; > $fp = fsockopen($server, $port, $errno, $errstr); > if (!$fp) { > return false; > } > fputs($fp, $headers); > fputs($fp, $urlencoded); > > $ret = ""; > while (!feof($fp)) > $ret.= fgets($fp, 1024); > fclose($fp); > return $ret; > } > > --- /PHP --- > > You can change the headers if you like ... > > Hope it helps. > -- > Mincu Alexandru intelinet.ro > Tel:+4 0745 369719 +4 021 3140021 > www.intelinet.ro [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php