Help send file
Moderator: General Moderators
Help send file
Please help how can I send XML file to a webservice on a server listening on a port
i.e
assume that i have xml file named file.xml
and the web service url is http://192.168.1.1:5555 where 5555 is the port i need to send for
how could i send this file.xml to the service URL
please help me i'm really getting crazy for this
thankyou
i.e
assume that i have xml file named file.xml
and the web service url is http://192.168.1.1:5555 where 5555 is the port i need to send for
how could i send this file.xml to the service URL
please help me i'm really getting crazy for this
thankyou
Code: Select all
<?xml version="1.0"?>
<SIGNData>
<SIGNMessage>
<Submit DeliveyReport="Yes" ReadReply="No" ReplyCharging="No" Adaptation="Yes" Redistribution="No">
<ID>-1</ID>
<Type>MT_TEST</Type>
<From AddrType="AT_EMAIL" UserID="test" UserCredit="10">test</From>
<Recipients>
<To AddrType="AT_MISSDN">202</To>
</Recipients>
<Subject>PHP</Subject>
<ObjectList>
<Object>
</Object>
</ObjectList>
<SmilFrame ID="0">
<Duration>3</Duration>
</SmilFrame>
<SmilFrame ID="1">
<Duration>3</Duration>
</SmilFrame>
<ServiceCode></ServiceCode>
<LinkedID></LinkedID>
<ClassType> MM_CT_PERSONNEL</ClassType>
<Priority> MM_PT_NORMAL</Priority>
<SubmitTime>2006-07-05T12:25:14-0400</SubmitTime>
<ExpiryTime>2006-07-08T00:00:00-0400</ExpiryTime>
<DeliveryTime>2006-07-05T00:00:00-0400</DeliveryTime>
<ReplyDeadLine></ReplyDeadLine>
</Submit>
</SIGNMessage>
</SIGNData>and i wanna send it to http://www.domainname.com:5050
a common html formto a php script the transmitted data would be provided by $_POST['textinput'] or $_FILE['fileinput'].
You service probably does something similar. Therefore it's imperative to know what parameters (names) must be used.
The xml document is not of interest here.
Code: Select all
<form method="post" action="xyz">
<input type="text" name="textinput" />
<input type="file" name="fileinput" />
<intput type="submit" />
</form>You service probably does something similar. Therefore it's imperative to know what parameters (names) must be used.
The xml document is not of interest here.
Ok, if you're sure, that the request message body is nothing more than the raw xml document I have to trust you 
you can try pear's http_client.the important thing is the third parameter set to true, telling http_client that the data already has proper encoding.
PEAR & http_client have to be installed for this to be working, see http://pear.php.net/manual/en/package.h ... client.php
you can try pear's http_client.
Code: Select all
<?php
require_once 'HTTP/Client.php';
$data='<?xml ... ?>';
$target = 'http://www.domainname.com:5050';
$client= new HTTP_Client;
$client->post($target, $data, true);
var_dump( $client->currentResponse() );
?>PEAR & http_client have to be installed for this to be working, see http://pear.php.net/manual/en/package.h ... client.php
I downloded the required file and it gives me error
Warning: require_once(HTTP/Request.php) [function.require-.....
so I downloaded Request.php and it give error again
Warning: require_once(HTTP/PEAR.php) [function.require-.....
again i downloaded the PEAR.php and it gives error
Warning: require_once(Net/Socket.php) [function.require-.....
and now i can't find this socket.php
Dear volka let me thank you a warm thankful due to your interest and i have another question that me help me solving my problem
while i'm trying the following code
it gives me the following error
Warning: fsockopen() [function.fsockopen]: unable to connect to 192.168.1.101:5050 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\AppServ\www\post\ex6.php on line 2
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060)
and i do listen to the bort with linux ethereal but i never recieve any package while listening to the port
once again i tried this code :
and i found the packeage goes well and i recieve it on my linux machine
so now I can't find where is the problem
and if i'm gonna use the second code only 1 missing thing is how to transfer the sample.xml with that stream i have
Warning: require_once(HTTP/Request.php) [function.require-.....
so I downloaded Request.php and it give error again
Warning: require_once(HTTP/PEAR.php) [function.require-.....
again i downloaded the PEAR.php and it gives error
Warning: require_once(Net/Socket.php) [function.require-.....
and now i can't find this socket.php
Dear volka let me thank you a warm thankful due to your interest and i have another question that me help me solving my problem
while i'm trying the following code
Code: Select all
<?php
$fp = fsockopen("192.168.1.101", 5050, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: 192.168.1.101\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>Warning: fsockopen() [function.fsockopen]: unable to connect to 192.168.1.101:5050 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\AppServ\www\post\ex6.php on line 2
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060)
and i do listen to the bort with linux ethereal but i never recieve any package while listening to the port
once again i tried this code :
Code: Select all
<?php
$fp = fsockopen("udp://192.168.1.101", 5050, $errno, $errstr);
if (!$fp) {
echo "ERROR: $errno - $errstr<br />\n";
} else {
fwrite($fp, "\n");
echo fread($fp, 26);
fclose($fp);
}
?>so now I can't find where is the problem
and if i'm gonna use the second code only 1 missing thing is how to transfer the sample.xml with that stream i have