Re: [PHP] post xml
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
[PHP] post xml file
Dear Sirs, I am trying to post a xml file to following http. But I can not. where can I find some source to read. https://xxx.xxx.xxx.xx/servlet/com.oks.buing.xml.detdrd Any help welcome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] post xml
I am sending an xml request as part of the url using urlencode to encode my xml. It doesnt work like that so the server that is receiving it doesnt seem to like the data in the query string. However, if I send it from a form using the method post then it works fine. Is there a way to send it by method post but without having to use a form? Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] post xml
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
RE: [PHP] post xml
I am sending an xml request as part of the url using urlencode to encode my xml. It doesnt work like that so the server that is receiving it doesnt seem to like the data in the query string. However, if I send it from a form using the method post then it works fine. Is there a way to send it by method post but without having to use a form? Thank you Make sure you urlencode() the data before you tack it into the URL. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] post xml
you can provide only one variable in the array: http_post( '195.57.250.36', 80, '/barceloDS/interface/xml', array( xml=$xml ) ); On some date, Diana Castillo wrote: thanks a lot I have a question, how would I specifiy the name of the variable I am sending if I am sending only one? If I send it like this does it know that what I am sending as $xml is also named the variable xml ? the example only has an array. http_post('195.57.250.36',80,'/barceloDS/interface/xml',$xml); -- 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
[PHP] Post XML to PHP via XMLHTTP VB Object
Hi, I'm trying to the MSXML DOM 3 from Visual Basic and send XML to a PHP page that sits on my Apache web server on SCO Unix. This is my VB Code: Dim xmlstr As New XMLHTTP30 Dim sXML As String sXML = Content-Type: text/xml; sXML = sXML ?xml version=1.0? sXML = sXML commandcommandtextInitialize/commandtext sXML = sXML returnsdataTrue/returnsdata sXML = sXML /command xmlstr.open POST, http://mywebserver/somepage.php;, False xmlstr.send sXML Set xmlstr = Nothing Pretty basic stuff. This succeeds, and at the Apache server level, in the logs I can see the POST request go through. In the file somepage.php - all I'm doing is running phpinfo() to see what the server thinks it's receiving. ? phpinfo(); ? Back at the VB level, I can see xmlstr.responseText which is the output from phpinfo(); I am not getting any HTTP_POST_VARS like I expected to receive. Has anyone done anything like this before? Is this mainly an issue with Apache rather than PHP? Thanks, Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Post XML to PHP via XMLHTTP VB Object
Try using the $HTTP_RAW_POST_DATA array. -- Steve Meyers [EMAIL PROTECTED] PHP [EMAIL PROTECTED] wrote in message 9clmgq$2fc$[EMAIL PROTECTED]">news:9clmgq$2fc$[EMAIL PROTECTED]... Hi, I'm trying to the MSXML DOM 3 from Visual Basic and send XML to a PHP page that sits on my Apache web server on SCO Unix. This is my VB Code: Dim xmlstr As New XMLHTTP30 Dim sXML As String sXML = Content-Type: text/xml; sXML = sXML ?xml version=1.0? sXML = sXML commandcommandtextInitialize/commandtext sXML = sXML returnsdataTrue/returnsdata sXML = sXML /command xmlstr.open POST, http://mywebserver/somepage.php;, False xmlstr.send sXML Set xmlstr = Nothing Pretty basic stuff. This succeeds, and at the Apache server level, in the logs I can see the POST request go through. In the file somepage.php - all I'm doing is running phpinfo() to see what the server thinks it's receiving. ? phpinfo(); ? Back at the VB level, I can see xmlstr.responseText which is the output from phpinfo(); I am not getting any HTTP_POST_VARS like I expected to receive. Has anyone done anything like this before? Is this mainly an issue with Apache rather than PHP? Thanks, Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Post XML to PHP via XMLHTTP VB Object
Hi, I tried the HTTP_RAW_POST_DATA array, but it doesn't appear to exist. Then I just tried to access it like a variable and it's empty. Have I not got something setup correctly for PHP? Thanks, Sam Steve Meyers wrote in message 9cn71i$d03$[EMAIL PROTECTED]... Try using the $HTTP_RAW_POST_DATA array. -- Steve Meyers [EMAIL PROTECTED] PHP [EMAIL PROTECTED] wrote in message 9clmgq$2fc$[EMAIL PROTECTED]">news:9clmgq$2fc$[EMAIL PROTECTED]... Hi, I'm trying to the MSXML DOM 3 from Visual Basic and send XML to a PHP page that sits on my Apache web server on SCO Unix. This is my VB Code: Dim xmlstr As New XMLHTTP30 Dim sXML As String sXML = Content-Type: text/xml; sXML = sXML ?xml version=1.0? sXML = sXML commandcommandtextInitialize/commandtext sXML = sXML returnsdataTrue/returnsdata sXML = sXML /command xmlstr.open POST, http://mywebserver/somepage.php;, False xmlstr.send sXML Set xmlstr = Nothing Pretty basic stuff. This succeeds, and at the Apache server level, in the logs I can see the POST request go through. In the file somepage.php - all I'm doing is running phpinfo() to see what the server thinks it's receiving. ? phpinfo(); ? Back at the VB level, I can see xmlstr.responseText which is the output from phpinfo(); I am not getting any HTTP_POST_VARS like I expected to receive. Has anyone done anything like this before? Is this mainly an issue with Apache rather than PHP? Thanks, Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]