Exzo Posted March 18, 2006 Report Share Posted March 18, 2006 Var izmantojot fsockopen() ir iespējams headerā nosūtīt User-Agent stringu, lai šādas konekcijas neizskatītos aizomīgas ar savu tukšo HTTP_USER_AGENT? Cik esmu mēģinājis, strings vienmēr paliek tukšs... Negribas, lai kāds vērīgs admins nobloķē manu IP :) Link to comment Share on other sites More sharing options...
Vebers Posted March 18, 2006 Report Share Posted March 18, 2006 "User-Agent: ".$_SERVER['HTTP_USER_AGENT']; Link to comment Share on other sites More sharing options...
Delfins Posted March 18, 2006 Report Share Posted March 18, 2006 Kads strings tukšs? Kādu pieškir tāds arī aizies.. Link to comment Share on other sites More sharing options...
Exzo Posted March 18, 2006 Author Report Share Posted March 18, 2006 (edited) iputs: $header = "GET $path HTTP/1.0\r\nHost: $host\r\n\r\n"; $header .= "User-Agent: Mozilla/5.0\r\n\r\n"; $header .= "Connection: Close\r\n\r\n"; autputs: HTTP/1.1 200 OK Date: Sat, 18 Mar 2006 21:51:03 GMT Server: Apache/1.3.29 (Unix) PHP/4.3.4 X-Powered-By: PHP/4.3.4 Connection: close Content-Type: text/html HTTP_USER_AGENT = REMOTE_ADDR = ***.***.***.*** bla bla bla... Tajā "User-Agent" es varu rakstīt ko gribu, rezultāts ir uzstājīgi nemainīgs..., lai gan neko fundametāli neatbilstošu http://lv2.php.net/manual/en/function.fsockopen.php es neredzu. Edited March 18, 2006 by Exzo Link to comment Share on other sites More sharing options...
john.brown Posted March 18, 2006 Report Share Posted March 18, 2006 Vai pa daudz \r\n tev nav? $header = "GET $path HTTP/1.0\r\nHost: $host\r\n"; $header .= "User-Agent: Mozilla/5.0\r\n"; $header .= "Connection: Close\r\n\r\n"; Tikai minējums :) Link to comment Share on other sites More sharing options...
Exzo Posted March 19, 2006 Author Report Share Posted March 19, 2006 (edited) Jopcik, problēma izrādās tiešam bija ar '\r\n', bet pirmajā rindā, uz pārējām šis ierobežojums (ja tā to var nosaukt) neattiecas... Jābūt: $header = "GET $path HTTP/1.0\r\nHost: $host\r\n"; Edited March 19, 2006 by Exzo Link to comment Share on other sites More sharing options...
bubu Posted March 19, 2006 Report Share Posted March 19, 2006 Muļķības! (par to tavu "ierobežojumu") Headerus jāatdala ar vienu \r\n nevis ar diviem. Jo ar diviem atdala POST sūtīto contentu no headeriem. Tātad, ja tev kautkur būs divi \r\n pēc kārtas, tad serveris tālākos datus uzskatīs par POST datiem nevis headeriem. RTFRFC Link to comment Share on other sites More sharing options...
Stopp Posted March 19, 2006 Report Share Posted March 19, 2006 RFC=reference ? :) Link to comment Share on other sites More sharing options...
bubu Posted March 19, 2006 Report Share Posted March 19, 2006 Request For Comments: http://www.rfc-editor.org/ Konkrēti par HTTP protokola specifikāciju: ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt (30 lpp) Link to comment Share on other sites More sharing options...
Exzo Posted March 20, 2006 Author Report Share Posted March 20, 2006 (edited) OK, būsim zināt... Bet konekcija enīvei jāzslēdz ar dubultu \r\n: $header .= "Connection: Close\r\n\r\n"; Edited March 20, 2006 by Exzo Link to comment Share on other sites More sharing options...
Recommended Posts