fsockopen

fsockopen pfsockopen函数被禁用的解决方法

本秂侑毒 提交于 2019-12-09 23:21:57
以下前提是你有服务器的最高权限,可以修改php.ini 方法一:   第一步:   php.ini文件中查找   allow_url_fopen = On   使其值为On   第二步:   php.ini文件中查找   extension=php_openssl.dll   如果前面有分号,去掉分号   第三步:   重启web服务器,apache或IIS 方法二:   1. vi php.ini   找到 allow_url_fopen 这个参数设置成 On,即   allow_url_fopen = On   2. 让你的php支持 opensll扩展。   默认,是没有openssl扩展的,只能重新编译安装。   yum install openssl openssl-devel   cd /usr/local/src/php-5.2.14/ext/openssl   /usr/local/php/bin/phpize   ./configure –with-openssl –with-php-config=/usr/local/bin/php-config   make && make install   看提示,把编译成的openssl.so 拷贝到你在php.ini 中指定的 extension_dir 下   3. vi php.ini   加入  

multi-thread, multi-curl crawler in PHP

冷暖自知 提交于 2019-12-09 16:41:26
问题 Hi everyone once again! We need some help to develop and implement a multi-curl functionality into our crawler. We have a huge array of "links to be scanned" and we loop throw them with a Foreach. Let's use some pseudo code to understand the logic: 1) While ($links_to_be_scanned > 0). 2) Foreach ($links_to_be_scanned as $link_to_be_scanned). 3) Scan_the_link() and run some other functions. 4) Extract the new links from the xdom. 5) Push the new links into $links_to_be_scanned. 5) Push the

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

旧街凉风 提交于 2019-12-09 03:23:22
问题 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.

Sending emails from PHPMailer using proxies IP addresses

血红的双手。 提交于 2019-12-09 03:02:08
问题 I need to send emails from PHPMailer using proxies IP addresses, I know that to do so, I need to use the fsockopen function so I can connect to the SMTP account, I also know that if I have to connect to the proxy I have to use the fsockopen function again. But using it fsockopen inside another fsockopen is not doable. I have transparent proxy and require no authentication. I need to send this to a distant SMTP server of an external Email Service Provider. The code I have tried : <?php //SMTP

Upload image/video to facebook asynchronously using php sdk 4

自作多情 提交于 2019-12-08 09:01:17
问题 I am trying to upload video/image to facebook albumb using php sdk 4 asynchronously.I googled and found that php asynchronous call be sent using fsockopen . However, it is not working for facebook request. I have two files, one for checking login and getting token. Then second file is called for uploading the file to facebook. Below is the code for first file: // start session session_start(); Yii::import('application.vendor.*'); require_once('facebook-4/autoload.php'); use Facebook

CURL vs fsockopen chunking

与世无争的帅哥 提交于 2019-12-07 07:47:36
问题 This may seem kind of weird.. but I need to evaluate/parse chunks being sent over HTTP with PHP. It's of note to say that the HTTP stream may never end. Is there any way I can parse chunks as I get them with CURL? Or do I have to resort to some home-brewed fsockopen() solution? 回答1: Take a look at the option CURLOPT_WRITEFUNCTION . You can define a callback that will be called when there's new data in the response. See the manual. 来源: https://stackoverflow.com/questions/3350029/curl-vs

php中 curl, fsockopen ,file_get_contents 三个函数 比较

让人想犯罪 __ 提交于 2019-12-06 20:13:41
赵永斌: 有些时候用file_get_contents()调用外部文件,容易超时报错。换成curl后就可以.具体原因不清楚 curl 效率比file_get_contents()和fsockopen()高一些,原因是CURL会自动对DNS信息进行缓存(亮点啊 有我待亲测) 范佳鹏: file_get_contents curl fsockopen 在当前所请求环境下选择性操作,没有一概而论: 具我们公司开发KBI应用来看: 刚开始采用:file_get_contents 后来采用:fsockopen 最后到至今采用:curl (远程)我个人理解到的表述如下(不对请指出,不到位请补充) file_get_contents 需要php.ini里开启allow_url_fopen,请求http时,使用的是http_fopen_wrapper,不会keeplive.curl是可以的。 file_get_contents()单个执行效率高,返回没有头的信息。 这个是读取一般文件的时候并没有什么问题,但是在读取远程问题的时候就会出现问题。 如果是要打一个持续连接,多次请求多个页面。那么file_get_contents和fopen就会出问题。 取得的内容也可能会不对。所以做一些类似采集工作的时候,肯定就有问题了。 sock较底层,配置麻烦,不易操作。 返回完整信息。 潘少宁-腾讯: file

Can I open socket in PHP from a specific IP (if the machine has two IPs)?

南楼画角 提交于 2019-12-05 20:55:18
I'm using PHPMailer and it uses fsockopen to access the SMTP server. But the machine has two IPs with different reverse DNS records. So in email headers I got the following: Received: from one-server.tld (HELO another-server.tld) ... I need to hide one-server.tld in favor of another-server.tld . But I need both IPs with their current RDNS settings. I think its not possible using fsockopen . But its possible in curl , fopen and stream functions. What you need is stream_socket_client() function. Here are some ways to achieve it. Using context parameters which can be used in fopen function family

Reading data from fsockopen using fgets/fread hangs

一曲冷凌霜 提交于 2019-12-05 20:54:22
问题 Here is the code that I am using: if (!($fp = fsockopen('ssl://imap.gmail.com', '993', $errno, $errstr, 15))) echo "Could not connect to host"; $server_response = fread($fp, 256); echo $server_response; fwrite($fp, "C01 CAPABILITY"."\r\n"); while (!feof($fp)) { echo fgets($fp, 256); } I get the first response: OK Gimap ready for requests from xx.xx.xx.xx v3if9968808ibd.15 but then the page times out. I have searched through stream_set_blocking, stream_set_timeout, stream_select, fread, etc.

CURL vs fsockopen chunking

血红的双手。 提交于 2019-12-05 12:35:48
This may seem kind of weird.. but I need to evaluate/parse chunks being sent over HTTP with PHP. It's of note to say that the HTTP stream may never end. Is there any way I can parse chunks as I get them with CURL? Or do I have to resort to some home-brewed fsockopen() solution? Take a look at the option CURLOPT_WRITEFUNCTION . You can define a callback that will be called when there's new data in the response. See the manual . 来源: https://stackoverflow.com/questions/3350029/curl-vs-fsockopen-chunking