PHP - Php Socket_write Byte[]
i have a code in c# and here use GetBytes(msg) for SSlStream.write, here send and received data correctly, here all work fine, now i want to make the same event in php, but here i cant see a SslSteam or similar(i think no problem, becouse i working with socket_connection, and i think SSL is only for security), now for compare i stop the code in c# for see what data is sending and try to convert in php, for send here, i can see a data byte{} in c# and with `
$message=unpack('C*',$message);` i can convert the string to byte[], comparing with c# value is the same so, here all is ok, my problem is when i try to write the request, becouse in SslStream.write accpet byte[] but socket_write no accept whe i try send ` socket_write($socket, '\n', strlen($message))` i have a error : socket_write() expects parameter 2 to be string and obvius is becouse socket_write() only accept string, but so.. as i can send my byte[], becouse the server only accept a byte[] please help me Similar TutorialsSay I have a server written in PHP (don't ask ). Let's say I have 10 users connected to my script and one of those users, for the sake of the example, needs 10MB of data sent to them. If I send that data via socket_write(), does my program execution stop (therefor locking up every other user) until the data has gone through, or is the actual task of sending data over the tubes passed on to some lower level OS function so my program can get on with its flow? Hi, I will be creating pdf in php using following library. http://sourceforge.net/projects/pdf-php/ After creating pdf ,I want to send PDF data in byte[] to web service. Any idea how to read pdf and prepare pdf data in byte[] array. With Kind Regards, Zohaib. Dear all, I'm trying to build an application to retrieve PDF documents from a site. The document being there is byte-served, so that I'm not able to get the complete document. When i do a curl get for the document I get only the below. Quote HTTP/1.1 302 Found Date: Mon, 02 Aug 2010 01:14:18 GMT Server: Microsoft-IIS/6.0 Via: 1.1 COMP-NLB-9C Content-Length: 176 Location: http://xxxxx.yyyy.com/0012345.pdf Content-Type: text/html; charset=utf-8 X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Cache-Control: private HTTP/1.1 404 Not Found Date: Mon, 02 Aug 2010 01:14:18 GMT Server: Microsoft-IIS/6.0 Via: 1.1 COMP-NLB-9C Content-Length: 1635 Content-Type: text/html; charset=ISO-8859-1 X-Powered-By: ASP.NET In firebug, I could see three GET requests. First one has the status '302 Found'. Second and third has status as '206 Partial Content'. How to get the complete file in this case. Or guide me, if I'm doing it in a wrong way. Regards, Ursvmg Just wondering if anyone knew of one? I have been looking for ages but can't find what I need. In java: Code: [Select] public class Test { public static void main(String[] args) { System.out.println((byte)0xff); } } Outputs: Code: [Select] -1 I've tried things like <?php $var = pack('H', 0xff); echo $var; ?> But that doesn't output anything I've been pulling my hair out for the past couple of hours working with simplexml_load_file(). I was attempting to consume a web service generated by asp.net that I've been consuming using CURL and a function to remove the BOM (byte order marker) so that I could load it into simplexml_load_string(). When I switched over to simplexml_load_file() to call the file instead of using CURL and my function, I was getting errors that it could not find the beginning '<' and that the document was empty and so on.. I couldn't find anything about simplexml_load_file() handling BOM characters, so I went for a walk. I came back to my desk and refreshed the page.. and it just started working. I changed nothing! Guess I should be happy that it started working, but I'd sure like to know why it was breaking in the first place, and then why it would suddenly start working without me doing anything. Has anyone else seen anything like this? Hi All, Just wondering whether it is possible to resize a jpg image to a specific size in bytes (while preserving height/width ratio). Thanks for any clues! |