473,805 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem socket connection in Unix

1 New Member
I'm moving a site from a Windows machine to the online environment (Unix) both running PHP5. But have a problem to get my data properly posted on the Unix machine.

On the unix machine my Content-Length of the post is 20 bytes less. I have put the 2 POST next to each other and they are the same.

Hereby the code that works fine on the Windows machine


[HTML]$body = 'theData';
$boundary = "---------------------".substr(md5(ra nd(0,32000)),0, 10);
$host = theHost;
$port = "8080";
$path = PathToScript;

$data ='--'.$boundary.'
Content-Disposition: form-data; name="theXML"

'.$body.'
--'.$boundary.'--

';
$thepost = 'POST '.$path.' HTTP/1.0
Content-Type: multipart/form-data; boundary='.$bou ndary.'
Host: '.$host.':8080
Content-Length: '.strlen($data) .'

'.$data;

$res = "";
$fsp = fsockopen($host , $port, $errno, $errstr, 30);
if($fsp) {
fputs($fsp, $thepost);

while(!feof($fs p)) {
$res .= fgets($fsp, 128);
}
fclose($fsp);
return $res;
}
else {
return "Error: " . $errstr;
}[/HTML]

But when I run the code on the unix machine the POST fails

Hereby the actual POST

win

[HTML]POST /Onlchk HTTP/1.0
Content-Type: multipart/form-data; boundary=---------------------dcf9082a17
Host: thehost:8080
Content-Length: 495
Connection: close

-----------------------dcf9082a17
Content-Disposition: form-data; name="theXML"

<OnlineCheck>
<Header>
<BuyerAccountId >ID</BuyerAccountId>
<AuthCode>COD E</AuthCode>
<Type>QUICK</Type>
</Header>
<Item line="1">
<ManufacturerIt emIdentifier></ManufacturerIte mIdentifier>
<ResellerItemId entifier/>
<DistributorIte mIdentifier>133 5085</DistributorItem Identifier>
<Quantity>1</Quantity>
</Item>
</OnlineCheck>
-----------------------dcf9082a17--[/HTML]



UNIX

[HTML]POST /Onlchk HTTP/1.0
Content-Type: multipart/form-data; boundary=---------------------c7bc77c261
Host: thehost:8080
Content-Length: 477
Connection: close

-----------------------c7bc77c261
Content-Disposition: form-data; name="theXML"

<OnlineCheck>
<Header>
<BuyerAccountId >ID</BuyerAccountId>
<AuthCode>COD E</AuthCode>
<Type>QUICK</Type>
</Header>
<Item line="1">
<ManufacturerIt emIdentifier></ManufacturerIte mIdentifier>
<ResellerItemId entifier/>
<DistributorIte mIdentifier>133 5085</DistributorItem Identifier>
<Quantity>1</Quantity>
</Item>
</OnlineCheck>
-----------------------c7bc77c261--[/HTML]



Anyone an idea ?
Sep 17 '07 #1
0 1126

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1247
by: adurbed | last post by:
Hi to everybody. First, let mi apologize if I'm doing a newbe question: I'm not a PHP programmer, but I have to solve a problem located in a PHP web page. Thanks in advance if you try to help me. I have a Linux host (Suse 9.2 2.6.8-24.14-smp) running apache2-2.0.50-7.3 and php4-4.3.8-8.2. In this host there is also a C custom made server. The PHP web page opens a socket in order to send data to the C server. The problem happens when...
2
2472
by: Li Ma | last post by:
Just want to share my experience on XML-RPC. We were working on a messaging middleware. We were using XML-RPC as communication protocol amoing client apps and server. Client could be written by Java, C/C++, VB, Delphi on both Windows or Unix platforms. Seams like XML-RPC( similiar to SOAP as you know) was a good choice for us. But while the project went on, I encountered some critical problems: First of all, performance problem....
11
2248
by: zaebos | last post by:
hi, i have this code which is part of a main program, to email from within the program a log file: int MailIt (char *mailserver, char *emailto, char *emailfrom, char *emailsubject, char *emailmessage) { SOCKET sockfd; WSADATA wsaData; FILE *smtpfile; #define bufsize 300
0
3928
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2 development client. Bur Its gives me following error message. I searched lots of things on net and tried on remote server but i didnt got suceess. Can any one tell me how to set TCP\IP connection protocol on server for particular instance. Becuase I think
5
24026
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2 development client. Bur Its gives me following error message. I searched lots of things on net and tried on remote server but i didnt got suceess. Can any one tell me how to set TCP\IP
2
2409
by: Mirko Vogt | last post by:
Hey, it seems that the socket-module behaves differently on unix / windows when a timeout is set. Here an example: # test.py import socket sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) print 'trying to connect...'
0
836
by: Gabriel Genellina | last post by:
En Wed, 09 Jul 2008 15:02:56 -0300, Mirko Vogt <lists@nanl.deescribi�: Which Python version? Which Windows version? I've tried 2.3.4, 2.4.4, 2.5.1 and 3.0a4, all on WinXP SP2, and in all cases I got an exception (details differ between versions). In no case I could make the connection succeed when nobody was listening at port 9999, as expected. --
0
988
by: Mirko Vogt | last post by:
Gabriel Genellina wrote: Hey, this is strange. Linux: $ python --version Python 2.5.2 $ Windows:
3
11687
by: TsanChung | last post by:
I want to make a java TCP socket client to communicate with a TCP server socket on linux. Are there some sample C unix server and java client socket programs available? The Richard Stevens' "Unix network programming" book described a TCP server (tcpcliserv04.c) and client (tcpcli04.c). I compiled and executed them successfully as follows: $ tcpcliserv04 &
0
10360
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10105
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9185
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3845
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.