Get string from web through dot net

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  07 July 2018
Get string from web through dot net

Hello, I'm trying to get a simple sting via PHP to maxscript. If you gotohttps://www.squirrel-02.com/_Con_/Get_Version.php you should get a simple page with a sting of "1.10".

I'm sort of list on this. What do I need to do to fetch this data?


ConNet = ((dotnetClass "System.Net.WebRequest").Create "https://www.squirrel-02.com/_Con_/Get_Version.php").GetResponse()
response=ConNet.GetResponse()
sysNet.dispose()
 
  07 July 2018
looks like this works but I don't like this way...


FN Get_Ver = (
   if internet.CheckConnection url:"https://www.squirrel-02.com" force:true == true then(
      timeouts=1000
      rollout httpSock "httpSock" width:0 height:0 (activeXControl port "MSXML2.ServerXMLHTTP" setupEvents:false releaseOnClose:false);
      createDialog httpSock pos:[-100,-100];destroyDialog httpSock;   
      gethttp=httpSock.port   
      httpSock=undefined   
      gethttp.SetTimeouts timeouts timeouts timeouts timeouts
      gethttp.open "GET" "https://www.squirrel-02.com/_Con_/Get_Version.php" false
      gethttp.send();   
      return gethttp.responseText
   )
   else(
      return "0.0"
   )
)
Ver = Get_Ver()
 
  07 July 2018

request = (dotnetClass "System.Net.WebRequest").Create "https://www.squirrel-02.com/_Con_/Get_Version.php"
response = request.GetResponse()
dataStream = response.GetResponseStream()
reader = dotnetobject "System.IO.StreamReader" dataStream
data = reader.ReadToEnd()


maybe ?
 
  07 July 2018
Oh!!!
the better one:

client = dotnetobject "System.Net.WebClient"
client.DownloadString "https://www.squirrel-02.com/_Con_/Get_Version.php"
 
  07 July 2018
the bigger problem is to check that url exists, valid, and you can connect to it
 
  07 July 2018
Thanks!

This should check if you have internet and URL from...

internet.CheckConnection url:"https://www.squirrel-02.com" force:true == true

or am I wrong about this function
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:26 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.