C# to get current IP

  • Автор темы Автор темы krisztos
  • Дата начала Дата начала
Do you mean retreive proxy that is used by instance?
 
C#:
Развернуть Свернуть Копировать
// create regular expression to parse ip
var re = new System.Text.RegularExpressions.Regex("(?<=<br />).*(?=<br />)");
// make a request to ip checking script
var request = ZennoPoster.HttpGet("chek.zennolab.com/index.php");
// parse response with regular expression
return re.Match(request).Value;
 
  • Спасибо
Реакции: krisztos и lokiys
Так как у меня лично http://myip.ozymo.com/ не отвечает, то можно загрузить на свой хостинг скрипт и держать ip от-туда.
PHP:
Развернуть Свернуть Копировать
<?php
echo $_SERVER['REMOTE_ADDR'];
?>
 
  • Спасибо
Реакции: Cop
you can test on any of our servers.

chek.zennolab.com
check2.zennolab.com
chekfast.zennolab.com

any of these servers have uptime 99,99%
no need to upload any scripts, no geo and speed limits.
 
C#:
Развернуть Свернуть Копировать
// create regular expression to parse ip
var re = new System.Text.RegularExpressions.Regex("(?<=<br />).*(?=<br />)");
// make a request to ip checking script
var request = ZennoPoster.HttpGet("chek.zennolab.com/index.php");
// parse response with regular expression
return re.Match(request).Value;

Above code stopped working - I also change regex, but still get not data in output variable. Is there any change in newest zenopsoter to get faster ip of local machine?
 
Works fine by my side
Can you open this Url in browser?
chek.zennolab.com/index.php
 
Yes, just changed C# to:

Код:
Развернуть Свернуть Копировать
// create regular expression to parse ip
var re = new System.Text.RegularExpressions.Regex("(?<=<br>).*(?=<br>)");
// make a request to ip checking script
var request = ZennoPoster.HttpGet("chek.zennolab.com/index.php");
// parse response with regular expression
return re.Match(request).Value;

Code executes with no error, but result variable is empty.
 
just update regular expression
C#:
Развернуть Свернуть Копировать
// create regular expression to parse ip
var re = new System.Text.RegularExpressions.Regex("(?<=<br />).*(?=<br)");
// make a request to ip checking script
var request = ZennoPoster.HttpGet("chek.zennolab.com/index.php");
// parse response with regular expression
return re.Match(request).Value;
 
  • Спасибо
Реакции: xopek2007 и krisztos

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)