Re: Bind IP with fsockopen
| From: | chris at aquanuke dot com | Date: | Thu, 12 Apr 2007 00:41:27 +0000 |
| Subject: | Re: Bind IP with fsockopen | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252655@lists.php.net to get a copy of this message | ||
Hi ive tried \r\n\n and pretty much every other combination I can think of. But I still
cant get it to return a line break.
Otherwise the script is working though.
----- Original Message ----- From: "Richard Lynch" <ceo@l-i-e.com>
To: <chris@aquanuke.com>
Sent: Wednesday, April 11, 2007 1:19 AM
Subject: Re: [PHP] Bind IP with fsockopen
fputs adds a newline, and you've got \r\n already, so your total output in the original is \r\n\n In the socket_bind one, you've got none of the \r\n stuff at all, much less \r\n\n On Tue, April 10, 2007 5:56 pm, chris@aquanuke.com wrote:Im having trouble converting this snippet to use the bind_socket function. my original code is.. <? $domain = 'internet.co.uk'; $fs = fsockopen('dac.nic.uk', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); } else { fputs($fs, "$domain\r\n"); $line = fgets($fs, 1024); echo $line; } ?> I think im getting stuck on the fputs bit.. I have this which does not work.. <?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = "$domain\r\n"; socket_write($sock, $request); //Read reply // Close socket_close($sock); ?> Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?