Re: Sending a lot of data to remote site

From: Date: Thu, 11 May 2006 23:24:46 +0000
Subject: Re: Sending a lot of data to remote site
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-236042@lists.php.net to get a copy of this message
Ryan A wrote:
Hi, I need to send an array of data to a remote site from my script, the array will contain anything from 1 to 5000 entries of less than 150 alpha numeric characters
Ok dude, braindump coming up - just some random thoughts and ideas, no concrete answers: 5000 * 100 = 500000 bytes - i.e. on average about half a meg, that less than many image uploads. so a POST could be acceptable. serialize will add to the ammount sent (and there is the security issue of unserlizing data) but you can POST serialized data as easily as anything else... what options do you have for the having over the data? what is the structure of the data you need to send? you might consider a custom 'serialization' that minimizes the ammount of extra data being sent e.g: $arr = array('123', '456', '789'); send( join('|', $arr) ); // instead of send( serialize($arr) ); yuo could consider JSON notation (probably more compact than serialize) - and in the process maybe even be the first guy to use JSON for server to server comms :-P you could setup an XML feed that they can request at their leasure. you could also skip the webserver and go directly to using FTP or SCP or something like that (would require a line or 2 of shellscript - using gzip to compact the data can also be very helpful the question as too whether this is alot to send depends on how often you need to send it - at once a day 1/2 a meg is peanuts in terms of traffic between 2 servers hanging on the backbone (or there abouts - by which I mean neither server is stuck behind some puny dial up or similar connection) whatever you do plan time to test alternative strategies before going full on and building a fully functional 'whatever'
each. Can you suggest the best method of doing this?
well the answer is probably not pigeons. or hedgehogs ;-)
Am looking at serialize() or a normal POST using some of the publicly available classes, but before i take a big step and regret it I would like to know your suggestions, recommednations and warnings. Thanks in advance. -Ryan ------ - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) ----- Fight back spam! Download the Blue Frog. http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com


« previous php.general (#236042) next »