fsockopen

fsockopen equivalent in JSP

廉价感情. 提交于 2019-12-01 13:55:08
How do i go about converting this code to JSP Any help appreciated..! $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: www.example.com\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } You can use the JSTL taglib for this. First declare the namespace at the top of the jsp using <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> And then use the c:import tag to include content from the specified url: <c

Unable to find the socket transport “https”

大憨熊 提交于 2019-12-01 13:41:17
问题 I'm using this to check for the availability of a URL: $fp = fsockopen($url, 443, $errno, $errstr); and I get this error back... Warning: fsockopen() [function.fsockopen]: unable to connect to https://example.com/soapserver.php:443 (Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?) in C:\Home etc etc.... I'm using an IIS server btw,( no its not my doing! ) so I think its something to do with not having open-ssl, but I'm not sure. Can anyone

How do I use fsockopen() to open a Telnet connection with a password?

不问归期 提交于 2019-12-01 12:01:44
I'd like to access a camera through it's Telnet capability. The problem is, it has Password-protection. This is no problem when doing it via Terminal, as I just use telnet 10.30.blah.blah then enter my password when prompted. But in php, I don't see the opportunity to input a password. $con = fsockopen("10.30.blah.blah", 25); $msg = "camera move left"; fwrite($con, $msg); Anybody have any ideas? UPDATE : I tried just using fputs to output the password as @Cfreak said, but still to no avail. If I do exactly what the script is trying in terminal, it works. Here's the code now: $con = fsockopen(

fsockopen equivalent in JSP

Deadly 提交于 2019-12-01 11:13:46
问题 How do i go about converting this code to JSP Any help appreciated..! $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: www.example.com\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } 回答1: You can use the JSTL taglib for this. First declare the namespace at the top of the jsp using <%@taglib prefix="c" uri="http:

File resource persistence in PHP

泄露秘密 提交于 2019-12-01 08:42:40
I'm developing a simple chat web application based on the MSN protocol. The server communicates with the MSN server through a file resource returned from fsockopen () . The client accesses the server via XMLHttpRequest . The server initially logs in, and prints out the contact list (formatted in an HTML table) which the client receives through the responseText () of the XMLHttpRequest object. Here's the problem. The file resource that is responsible for communication with the MSN server must be kept alive in order for all chat related functions to work (creating conversations, keeping track of

File resource persistence in PHP

对着背影说爱祢 提交于 2019-12-01 06:53:50
问题 I'm developing a simple chat web application based on the MSN protocol. The server communicates with the MSN server through a file resource returned from fsockopen () . The client accesses the server via XMLHttpRequest . The server initially logs in, and prints out the contact list (formatted in an HTML table) which the client receives through the responseText () of the XMLHttpRequest object. Here's the problem. The file resource that is responsible for communication with the MSN server must

What is blocking fsockopen?

自古美人都是妖i 提交于 2019-12-01 04:25:47
After struggling for half a day, I finally manage to get reCAPTCHA to work by converting this function: function _recaptcha_http_post($host, $path, $data, $port = 80) { $req = _recaptcha_qsencode ($data); $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $host\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; $http_request .= "Content-Length: " . strlen($req) . "\r\n"; $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; $http_request .= "\r\n"; $http_request .= $req; $response = ""; if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) )

What is blocking fsockopen?

六眼飞鱼酱① 提交于 2019-12-01 01:44:03
问题 After struggling for half a day, I finally manage to get reCAPTCHA to work by converting this function: function _recaptcha_http_post($host, $path, $data, $port = 80) { $req = _recaptcha_qsencode ($data); $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $host\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; $http_request .= "Content-Length: " . strlen($req) . "\r\n"; $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; $http_request .= "\r\n";

解决在TP5中无法使用快递鸟查询API接口方案

允我心安 提交于 2019-11-30 18:54:13
快递鸟的接口对接其实很简单,先去 快递鸟官网 注册账号,登陆把基本信息填好,然后在 产品管理中 订购一下“物流查询”,免费,不过也有增值服务产品是收费,免费的有对接口调用频率限制,结合自己的应用流量够用就可以。 使用前复制一下账号下的用户ID和API key,并且快递鸟对各个API提供了各种语言的demo,其实下载下来,找一下平时寄快递的运单号,本地运行一下就能用了。(名称: KdApiSearchDemo) 其实拿到demo代码,可以放到项目中,因为demo是以面向过程写的,所以为了方便自然就想封装一下。 namespace data\extend; use data\service\Config; /** * 快递鸟即时查询接口 * @author Administrator * */ class Kdniao{ private $ebusinessid;//商户ID private $appkey; //商户秘钥 private $request_type;//请求类型 private $request_url; //请求URL /** * 构造函数 */ public function __construct($shop_id){ $config=new Config(); $express_config=$config-

How do I get SSL working in fsockopen?

喜欢而已 提交于 2019-11-30 11:08:13
I'm running PHP 5.2.6 on Windows, I have extension=php_curl.dll and extension=php_openssl.dll uncommented in php.ini; as such I can see the following in phpinfo : curl cURL support enabled cURL Information libcurl/7.16.0 OpenSSL/0.9.8g zlib/1.2.3 openssl OpenSSL support enabled OpenSSL Version OpenSSL 0.9.8g 19 Oct 2007 I'm not sure that having cURL enabled is vital to this, but since it mentioned OpenSSL I thought I'd include it here anyway for completeness. What I want to do is simple: make a POST request to another server over SSL using fsockopen . My code so far is this: $host = 'www