Jump to content

Search the Community

Showing results for tags 'fsockopen'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 3 results

  1. Hey guys, I'm trying to show a few ips are online or not, but the return is always as online. The function I'm trying to use is the one below: <?php function ping($host) { $conectado = fsockopen($host, 80, $numeroDoErro, $stringDoErro, 255); if ($conectado) { return true; }else{ return false; fclose($conectado); } } ?> The variable $host receives an ip like this: 172.16.10.50 I'm calling the function like this: $ping = ping($dados[ip]); I need some extra configuration to work properly?
  2. Hey I'm running a website where I get quite a few proxy users evading bans. As an attempt to block them, I added this code: if(@fsockopen($_SERVER['REMOTE_ADDR'], 80, $errstr, $errno, 1)) die("Your magical proxy adventure ends here."); if(@fsockopen($_SERVER['REMOTE_ADDR'], 3128, $errstr, $errno, 1)) die("Your magical proxy adventure ends here."); if(@fsockopen($_SERVER['REMOTE_ADDR'], 8080, $errstr, $errno, 1)) die("Your magical proxy adventure ends here."); I know it probably could be a little shorter, but it worked which was the main thing. However, a few of my users run legitimate websites off their home networks, so they ended up being blocked by this. I've attempted something, but I am receiving the error: syntax error, unexpected '{', expecting '(' on the first ELSE IF clause. The full code is: if (in_array($_SERVER['REMOTE_ADDR'], $whitelist)) { // User is whitelisted, so we continue without going to the check. } else if { if (@fsockopen($_SERVER['REMOTE_ADDR'], 80, $errstr, $errno, 1) || (@fsockopen($_SERVER['REMOTE_ADDR'], 8080, $errstr, $errno, 1) || (@fsockopen($_SERVER['REMOTE_ADDR'], 3128, $errstr, $errno, 1) } else { // User isn't whitelisted, but is not a proxy, continue! } Can anyone point me in the right direction?
  3. I'm having an issue using fsockopen to connect to smtp.gmail.com in which I always receive the error "Failed to connect to server: Connection timed out". The issue seems very similar to an old bug fixed in late 2010: https://bugs.php.net/bug.php?id=50953 I'm using the following script to test: // connect to the smtp server $smtp_conn = @fsockopen("ssl://smtp.gmail.com", // the host of the server 465, // the port to use: 25, 465, 587 $errno, // error number if any $errstr, // error message if any 5); // give up after ? secs // verify we connected properly if(empty($smtp_conn)) { $error = array("error" => "Failed to connect to server", "errno" => $errno, "errstr" => $errstr); echo "SMTP -> ERROR: " . $error["error"] . ": $errstr ($errno)\n"; } else { fclose($smtp_conn); echo "Connected!\n"; } Replacing the host argument with tsl://smtp.gmail.com or simply smtp.gmail.com and any combination of ports 25, 465, 587 also fails. Yet other smtps connect fine (e.g. smtp.live.com:587, smtp.mail.yahoo.com:465). A firewall or other blocking is not the issue. This is on a VPS with the firewall disabled and, furthermore, I can successfully connect to smtp.gmail.com (and send an email) via openssl s_client. So basic access to the server/port is not the prob. Is there any possibility this old bug (id=50953) is still lingering around in a fairly recent 5.3 version of PHP? Or any suggestions on other possible causes? I am using 5.3.17-1~dotdeb.0 and same code works fine on a different VPS with PHP 5.2.17-1.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.