Liman php den kontrol

3 Cevap php

Ben bir PHPlist yükleme gmail pop sunucusuna bağlanmaya çalışıyorum ve başarısız, ama benim host portu 995 veya açılmış emin değilim. Onlar açtı söylüyorlar, ama ben şüphe duyuyorum. I bir php komut kontrol edebilirsiniz bir yolu var mı? Ben OS ne olduğunu emin değilim ama onlar, bir windows sunucu üzerinde php 5.2.0 yayınlanıyor. phpinfo () "Windows NT DEDI514 5.2 build 3790" diyor

3 Cevap

You can put code in a php script to open a connection to a specific hostname (or IP address) and port. If you know the expected response, you should be able to tell if you are getting a connection. If you get something like "Connection refused", then either you are being blocked, or the destination host is not accepting connections on that port.

Bu örnek IP adresi 192.0.2.0 ve port 995 kullanır. Sınamak istediğiniz ne olursa olsun bu değiştirin.

<?php
    echo "\nOpening connection\n\n";

    $fp = fsockopen("192.0.2.0", 995, $errno, $errstr);
    if (!$fp) {
        echo "ERROR: $errno - $errstr\n";
    } else {
        echo fread($fp, 1024);
        fclose($fp);
    }
?>

Ayrıca kullanarak sunucuya veri göndermek

fwrite($fp, "blah blah blah\r\n");

fsockopen here hakkında daha fazla bilgi bulunmaktadır.

Ben ping veya port üzerinde cevap verecek bir makineye traceroute gerekir düşünüyorum.

Bu makalede, bilmek istiyorum daha fazla olmalı, ama test etmek için değiştirebileceğiniz altındaki bir örnek komut dosyası var.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=8&txtCodeId=1786

There are some other scripts here: http://www.theworldsend.net/

Şahsen bu herhangi biri için kefil olamaz, ama onlar ne gerek gibi görünüyor.

Eğer sunucuya ssh veya telnet eğer Ve tabii ki, size ping ve traceroute komutları kullanarak çok daha kolay tüm bu yapabilirsiniz.

Belki safe mode etkin? Bu, diğer sunucularda hizmetlerini arayarak önler.

Edit: All filesystem and stream functions are affected by the safe mode settings!

open_basedir ayar Fopen etkiler (!)