Sigx

We are the future in the past.
It is currently Wed Sep 19, 2018 2:12 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: New Mac Client (solved)
PostPosted: Thu May 12, 2005 8:09 am 
Offline

Joined: Thu May 12, 2005 12:44 am
Posts: 28
Location: Netherland
I'm trying to make a new client for MacOS X (which might also be able to work under classic)
but i'm having trouble with sending the data to the server..

I've looked around on the forum, and i've come up till the following URL which get's send via an httpsocket.post command

http://sigx.yuriy.net/update.php/userna ... ion.debug*<*CPU:%201200Mhz&version=SigOSX1

where UseNam = my username & UsePass = my user password

but i keep getting "[--- Error updating --]" back from the site.
so i need to know if and what i did wrong

Thanks in advance 8)

_________________
Image


Last edited by Marius_Th on Thu May 12, 2005 10:30 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 8:28 am 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
you have to do send the html request as a POST

_________________
Image
~~~SigX C++ Edition~~~


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 8:33 am 
Offline

Joined: Thu May 12, 2005 12:44 am
Posts: 28
Location: Netherland
i would like to think i did..

HTTPSOCKET.post URL
where URL is the link i just gave

(this is in 'basic' language)

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 8:35 am 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
can you paste the code for the post ?

_________________
Image
~~~SigX C++ Edition~~~


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 8:37 am 
Offline

Joined: Thu May 12, 2005 12:44 am
Posts: 28
Location: Netherland
i've set up the data fields as an array, and am still working on taking care of that a bit
and the urlencode(data) takes care of the 'translating of entities' like &, = and such

Code:
  dim URL,Data as string
  dim x as integer
  x = 0
 
  if cbx(0).text <> "" then
    do
      data = data + "*<*" + cbx(x).text
      x=x+1
    loop until x = pdataenabled
    //data = "Music: " + cbx.text + "*<*"
  end if
 
  URL = "http://sigx.yuriy.net/update.php/username=" + app.SigXUseNam + "&password=" + app.SigXUsePass + "&data=" + URLEncode(data) + "&version=SigOSX1"
 
  HTTPSOCKETone.post URL

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 8:46 am 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
what I do in C++ version is i connect to
http://www.sigx.yuriy.net/update.php
then I send the data with socket.send

*body = "username=" + m_username + "&password="..............

*urlPath = "/update.php";
*hostName = "sigx.yuriy.net";

the data being
*m_strMessage += "POST " + *urlPath + " HTTP/1.1\r\n";
*m_strMessage +="Host: " + *hostName + "\r\n";
*m_strMessage +="User-Agent: User-Agent: SigX\r\n";
*m_strMessage +="Content-Type: application/x-www-form-urlencoded\r\n";
*m_strMessage +="Content-Length: ";
*m_strMessage += *bodylength;
*m_strMessage += "\r\n";
*m_strMessage +="\r\n";
*m_strMessage+= *body;

m_sConnectSocket.Send( *m_strMessage, msglength );

_________________
Image
~~~SigX C++ Edition~~~


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 8:54 am 
Offline

Joined: Thu May 12, 2005 12:44 am
Posts: 28
Location: Netherland
buddy1007 wrote:
what I do in C++ version is i connect to
http://www.sigx.yuriy.net/update.php
then I send the data with socket.send

*urlPath = "/update.php";
*hostName = "sigx.yuriy.net";

the data being
*m_strMessage += "POST " + *urlPath + " HTTP/1.1\r\n";
*m_strMessage +="Host: " + *hostName + "\r\n";
*m_strMessage +="User-Agent: User-Agent: SigX\r\n";
*m_strMessage +="Content-Type: application/x-www-form-urlencoded\r\n";
*m_strMessage +="Content-Length: ";
*m_strMessage += *bodylength;
*m_strMessage += "\r\n";
*m_strMessage +="\r\n";

m_sConnectSocket.Send( *m_strMessage, msglength );

ok, now i'm not really at home with C++
what is \r\n, *urlpath, *hostname, *bodylength and such all for? ^^;;
and it's all send as a string to http://www.sigx.yuriy.net/update.php afterwards?

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 8:59 am 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
It might not be the same in your lang your coding
first I connect to SigX.yuriy.net on port 80 with the socket
then after its connected I send the data as text

the \r and \n shuld be in all langs
\r = carriage return
\n = new line

urlpath and host names are
*urlPath = "/update.php";
*hostName = "sigx.yuriy.net";

I edited the prev post and added thosue thigns to the example i show. also last line in that is the data

_________________
Image
~~~SigX C++ Edition~~~


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 9:02 am 
Offline

Joined: Thu May 12, 2005 12:44 am
Posts: 28
Location: Netherland
ah alright, i see what i can do with this
thanks ever so much ^^;

Edit:
in the end, is it supposed to sent a really long URL with all the data in it, or did i have that idea wrong?

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 9:10 am 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
*body = "username=" + m_username + "&password="..............
*m_strMessage+= *body;

*body <--- is all the data username & password & data & version ....

_________________
Image
~~~SigX C++ Edition~~~


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 9:13 am 
Offline

Joined: Thu May 12, 2005 12:44 am
Posts: 28
Location: Netherland
and body get's attached like http://www.sigx.yuriy.net/update.php/*body, and then sent?

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 9:16 am 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
1) the socket is connected
2) the data packet is POSTed through a socket.send
the data can include the urlpath, hostname, user agent, content type, and body

_________________
Image
~~~SigX C++ Edition~~~


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 9:21 am 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
I found this thing on google, it looks like it has alot of examples on socket and posting.

http://www.nd.edu/~jvanderk/rb/httpsocket.sit.hqx

_________________
Image
~~~SigX C++ Edition~~~


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 9:30 am 
Offline

Joined: Thu May 12, 2005 12:44 am
Posts: 28
Location: Netherland
thanks
at the moment it does seem to connect, but the page recieved is "[--- error updating ---]"

hope the example will help out ^^;

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 11:02 am 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1395
Location: Los Angeles
[--- error updating ---] occures when the username or password or data is empty. use this test page i made just for that reason

http://sigx.yuriy.net/test/postget.php

_________________
Image

Image

Image


Last edited by yuriy on Fri May 13, 2005 9:25 pm, edited 1 time in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group