fsockopen

Unable to find the socket transport "https"

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?) ...

Wordpress autologin using CURL or fsockopen in PHP

Client wants to click a link and auto login to Wordpress backend admin section. I tried using fsockopen, code below. Didn't work. $post_data['user_login'] = 'admin'; $post_data['user_pass'] = 'password'; $post_data['wp-submit'] = 'Log In'; $post_data['redirect_to'] = 'http://example.com/wp-admin/'; //traverse array and prepare data fo...

PHP fsockopen() / fread() returns messed up data

I read some URL with fsockopen() and fread(), and i get this kind of data: <li 10 ></li> <li 9f >asd</li> d <li 92 Which is totally messed up O_O -- While using file _ get _ contents() function i get this kind of data: <li></li> <li>asd</li> Which is correct! So, what the HELL is wrong? i tried on...

PHP fsockopen Is Slow

I'm playing around with the IMAP protocol in PHP using fsockopen to send and receive commands. My preliminary experiments work but are insanely slow. It takes about 2 minutes for the simple function below to run. I've tried several different IMAP servers and have gotten the same result. Can anyone tell me why this code is so slow? <?php...

php fsockopen unable to connect, connection timeout error

Hello, I am running a local apache server on an ubuntu machine, and i am trying to use the phpmailer class to send mail. It tries to connect by fsockopen to the mail server, but it throws a timeout error. I tried setting the timeout to 15sec with no luck. It does work on other machines. How can i find out if my ISP has blocked requests...

What are the causes of a fsockopen() error?

I have two scripts that are identical but one works on my home testing server and when uploaded to my hosting provider (site5) it times out. ht3k.homedns.org/hmm/example.php (is working on my home server) 74.54.165.77/~cvxadmin/pvpgnserverscript/example.php (isn't working on my site5 account) I'm stumped, what can I do to fix this? ...

PHP Sockets - Not Reading Output

Hi all, I'm having some problems reading from a socket. Basically, I can connect to the machine without an error. I can write to the machine without an error. I cannot seem to read the output. Here is what I'm doing: $header1 = chr(0xFF).chr(0xFB).chr(0x1F).chr(0xFF).chr(0xFB).chr(0x20).chr(0xFF).chr(0xFB).chr(0x18).chr(0xFF).chr(0xFB)...

fsockopen error I want to skip

$sock = fsockopen($url_parts['host'], (isset($url_parts['port']) ? (int)$url_parts['port'] : 80), $errno, $errstr, 30); if (!$sock) return false; I have list on my db for urls, that I am visiting, and occassionally I get this: I am getting "Fatal error: Maximum execution time of 30 seconds exceeded..." Its expected, since it goes to ...

Socket transport "ssl" in PHP not enabled

I'm having trouble enabling the socket transport "ssl" in PHP. When I run my script, I get the error: Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.my.site.com:443 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) I'm running IIS6 on Windows and...

Upload a file to Google Code Hosting with PHP and fsockopen().

Hi, Google Code Hosting has the ability to upload files to it remotely. I've been trying to program a script in PHP which uploads files to my account. Here's the script itself: <?php /* I censored a few details. */ $username = '***@gmail.com'; $password = '***'; $file = 'test.txt'; $project = '***'; $summary = 'test'; $uploadHost = "...

How do I get SSL working in fsockopen?

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 200...

How can a while() loop not stall when using fsockopen() and fgets() in PHP?

This is the basic connection code for a small PHP IRC bot. The problem is that it seems that the while() loop does not progress beyond fgets() until it receives data from the IRC server. I want the while() loop to iterate regardless if the IRC server has not yet sent data. Is this possible? $socket = fsockopen($config['irc_server'], $co...

Fsockopen times out on isps server

Hi, I have an apache server sunning at home for test purposes and I have an account with a uk isp. When using fsockopen on my home server everything works fine, I can connect on different ports (I am using specifically 25 for testing a mail server) but when I upload my site to my ISP then I can no longer connect using fsockopen - it jus...

Why does fsockopen have performance problems and not fopen when sending a POST request in PHP?

I have tried two different implementations for simulating POSTing a form. One uses fsockopen (example here: http://www.faqts.com/knowledge_base/view.phtml/aid/7962) and the other uses fopen (example here: http://netevil.org/blog/2006/nov/http-post-from-php-without-curl). I ran into some serious performance problems with fsockopen - whe...

Convert CURL to fosckopen in PHP

I am working on setting up credit card processing for a site that is live. PHP wasn't compiled with CURL support and I don't want to take the site down to recompile PHP with that, so I am trying to use a different method than the example code provided. Example CURL code: function send($packet, $url) { $header = array("MIME-Version...

Strange delay POSTing from php fsockopen

Hi all, I'm working with the following section of php code. The purpose is to POST an image file from one server to another. This works perfectly and very quickly as long as the file is < ~250k. Much over 250k, and the process time jumps to ~60 seconds, and increases from there with image size. Any ideas? Thanks! John $fileContents ...

fsockopen issue when opening port to sphinx only in php

I have an issue when connecting php and only php to the sphinx daemon. I have tested the sample sphinx php example test.php and narrowed it down to being a connection problem. I have the follow piece of code which shows the problem, <?php $fp = @fsockopen ( '127.0.0.1', '9312', $errno, $errstr,300 ); if(!$fp) { echo "$errstr ($errno)...

View contents of file with Content-disposition: attachment using socket

Hi, I want to parse the contents of a dynamic .csv file. However, this code (obviously with duff file names, etc.): $socket = fsockopen("www.example.com", 443); fwrite($socket, "GET /dynamicCsv.csv?param=value HTTP/1.1\r\n"); fwrite($socket, "Host: www.example.com\r\n"); fwrite($socket, "Connection: close\r\n"); fwrite($socket, "\r\n")...

File resource persistence in PHP

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 thr...

Post data and recieve content fsockopen

I have no clue how to use fsockopen. Could someone please post a small example of how to use fsockopen to post data to a website that is not mine, and then return the source code of the page with post data. An example of what id like is lets say a website will multiply whatever the form with the name "output" says by 5. So if i post data...