note 39511 modified in function.fsockopen by et

From: Date: Sat, 06 Mar 2004 14:24:20 +0000
Subject: note 39511 modified in function.fsockopen by et
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66343@lists.php.net to get a copy of this message
[Edit: There are functions to do that. See http://php.net/rawurlencode and http://php.net/urlencode ] If, when you're working against a web server, you get a 400 Bad Request, it might be because you have spaces in the URI. Spaces should be replaced with %20 like so: function requestFromWebServer($document) { $document = str_replace(" ", "%20", $document); $request = "GET /$document HTTP/1.0\r\n" . "Connection: Close\r\n" . "\r\n"; //... } There are probably other characters that need to be replaced too. --was-- If, when you're working against a web server, you get a 400 Bad Request, it might be because you have spaces in the URI. Spaces should be replaced with %20 like so: function requestFromWebServer($document) { $document = str_replace(" ", "%20", $document); $request = "GET /$document HTTP/1.0\r\n" . "Connection: Close\r\n" . "\r\n"; //... } There are probably other characters that need to be replaced too. http://www.php.net/manual/en/function.fsockopen.php

« previous php.notes (#66343) next »