fsockopen

PHP Post data with Fsockopen

I am attempting to post data using fsockopen, and then returning the result. Here is my current code: <?php $data="stuff=hoorah\r\n"; $data=urlencode($data); $fp = fsockopen("www.website.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "POST /script.php HTTP/1.0\r\n"; $out .= "Hos...

Do sockets opened with fsockopen stay open after you leave the page via your browser?

if(isset($_GET['host'])&&is_numeric($_GET['time'])){ $pakits = 0; ignore_user_abort(TRUE); set_time_limit(0); $exec_time = $_GET['time']; $time = time(); //print "Started: ".time('h:i:s')."<br>"; $max_time = $time+$exec_time; $host = $_GET['host']; for($i=0;$i<65000;$i++){ $out .= 'X'; ...

php_network_getaddresses: getaddrinfo failed: Name or service not known

Here is a snippet of my code $fp = fsockopen($s['url'], 80, $errno, $errstr, 5); if($fp){ fwrite($fp, $out); fclose($fp); When I run it, it outputs: unable to connect to www.mydomain.net/1/file.php:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known I can't figu...

using php Download File From a given URL by passing username and password for http authentication

Hi all, I need to download a text file using php code. The file is having http authentication. What procedure I should use for this. Should I use fsocketopen or curl or Is there any other way to do this? I am using fsocketopen but it does not seem to work. $fp=fsockopen("www.example.com",80,$errno,$errorstr); $out = "GET abcdata/feed...

Interrupting the TCP handshake with PHP's fsockopen()?

Take for example: fsockopen(tcp:\\example.com, 80, $errno, $errstr, 5) My friend has just informed me that PHP will always wait for the TCP handshake to be completed before closing the socket. However, I find it difficult to believe that PHP can't interrupt the handshake. Is it possible? If so, how? ...

PayPal integration woes: PDT hangs on return to site

Hi, I'm implementing PayPal IPN & PDT. After some headache & time at the sandbox, IPN is working well and PDT returns the correct $_GET data. The implementation is as follows: Pass user ID in form to PayPal User buys product and triggers IPN which updates database for given user ID PDT returns transaction ID when user returns to site ...

PHP fsockopen doesnt return anything

Hi! I am modifying a PHP db wrapper for the redis database. Here's how my function looks: public function connect() { $sock = @fsockopen('localhost', '6379', $errno, $errstr, 2); if ($sock === FALSE) { return FALSE; } else { stream_set_timeout($sock, 2); return $sock; } } What I want t...

How to get a list of programs that have connected to the Apache socket?

I have a LAMP server running. External services connect to this server (services running on iPhone). I want, from a php script, to get a list of all the services that have connected to the Apache server... How do I do it? Should I use fsockopen? Any help would be greatly appreciated. ...

PHP fsockopen to curl conversion

i have this piece of code: <?php $host = "registration.mypengo.com"; $request = "/webregistration.aspx?taskaction=serviceresponse&partner=157&subid=" . $subid . "&msisdn=" . $msisdn . "&type=TEXT&data=" . $data . "&serviceid=" . $service_id; $fp = fsockopen($host, 80, $errno, $errstr, 3.0); if($fp) { fwrite($fp, "GET $request HTT...

Using PHP to read a web page with fsockopen(), but fgets is not working

Im using this code here: http://www.digiways.com/articles/php/httpredirects/ public function ReadHttpFile($strUrl, $iHttpRedirectMaxRecursiveCalls = 5) { // parsing the url getting web server name/IP, path and port. $url = parse_url($strUrl); // setting path to '/' if not present in $strUrl if (is...

fsockopen not working?

I am trying to connect to an IRC server via PHP on a command line using Windows 7. Everytime when running this: $socket = fsockopen($irc_server, 6667, $errno, $errstr, 5); $errno = 0, $errstr = "" and $socket = 'Resource id #4' (using die($socket);) What is the cause of this, and how can I debug more into this. The following code: ...

script dying out and contents are being prompted for download due to fsockopen - how do I fix it

Hi guys, I'm working with zend framework and recently had terrible issue swith my code. Actually I'm developing a webfront for emails and users enter their mail server details and are able to check on their email via my system. The issue is that whenever I would try to connect to a mailserver my system just dies out sometimes and instea...

Rare strange readings with fsockopen

I'm using fsockopen on a small cronjob to read and parse feeds on different servers. For the most past, this works very well. Yet on some servers, I get very weird lines in the response, like this: <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> 11 <item> <title> 1f July...

php fsockopen() in a loop

Hi everyone, I want to do an application that sends data to specified ip range.However,i faced a problem like this.When i put fsockopen function in a loop the code returns nothing and the page(browser page) is alwalys loading mode.When i do a single fsockopen to google it works but when i do it in a loop it doesnt... Thanks for advance.....

CURL vs fsockopen chunking

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

fsockopen unlimited timeout

Hello, there is a way to make a fsockopen with unlimited timeout ? Like CURLOPT_TIMEOUT=0 ? ...

fsockopen() from 127.0.0.1 is not working

I'm trying to connect to an SMTP server from my local machine (127.0.0.1). I'm able to connect to other SMTP servers, but this one in particular will not connect from my local machine, it will connect however from 4 other remote servers I have tested on. I receive the following error trying to connect from my local machine: Message...

Error 500 when updating Twitter status using fsock and oauth.

Hi everyone, I am having some slight problem with Twitter Oauth and fsock. The reason I am using fsock, is to cater people that do not have curl installed. So here goes my problem. I was able to use fsock to get the access token however when I use fsock to update twitter status. It returns me with an Internal Error 500. Here is what I...

ping a server thru a specific port (fsockopen) in php

function checkServer($domain, $port=80) { global $checkTimeout, $testServer; $status = 0; $starttime = microtime(true); $file = @fsockopen ($domain, $port, $errno, $errstr, $checkTimeout); $stoptime = microtime(true); if($file) { fclose($file); $status = ($stoptime - $starttime) * 1000; $status = floor($status); } else...

Any other good option for fsockopen?

I'm trying to make the code below work with curl or something. I have already taken a look at the curl fsockopen conversion but it doesn't work. The code works except that fsockopen is disabled on my host. Any help will be appreciated. $host = substr($hostport,0,50); $port = substr($hostport,50,10); $issecure = substr($hostport,60,1); ...