FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log inLog in 


HTTP Demo

Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog Tips & Samples
View previous topic :: View next topic  
Author Message
Chan Bok



Singapore
Joined: 13 Sep 2000
Posts: 90

PostPosted: 8 Jun 2010 15:33    Post subject: HTTP Demo Reply with quote

This demo uses WinInet (HTTP) to transfer data between client and server.
The demo is developed on VIP7.2 (CE). To compile, you need to include wininet.lib

The demo essentially simulates the following HTML form:

  <form enctype="multipart/form-data" action="myphp.php" method="POST">
   Fields:
    <input type="text" name="fields" /><br />  
    <input type="submit" value="Send!" />
   </form>

The httpPost() function has also been extended to perform file upload/download/chat
in the Axon Idea Processor (currently Axon2011 R1.10 Beta).
These additional features are omited to avoid complicating the demo.

You may copy and use this demo for any purpose, commercial or otherwise.

Chan Bok
Axon Research



httpDemo.zip
 Description:

Download
 Filename:  httpDemo.zip
 Filesize:  29.19 KB
 Downloaded:  876 Time(s)


_________________
Chan Bok
Axon Research
Back to top
View user's profile Send private message Visit poster's website
Timmy




Joined: 10 Aug 2010
Posts: 7

PostPosted: 11 Aug 2010 16:49    Post subject: Reply with quote

Hi, I'm using VIP 7.2 CE and I can't use this demo because of some troubles with wininet.lib, but I guess I don't need it, because the same thing on VIP 5x was ok with using just httplay. So here is the problem. I always get only httplay_error for any requests. Here is sample code (I use other URL in my project):


onPushButtonClick(_Source) = button::defaultAction:-
        httplay::httplay_sendrequests(
                                                    This:getVpiWindow(),
                                                    12345,                                            
                                                    "http://discuss.visual-prolog.com",
                                                    80,
                                                    [httplay::simple_req(httplay::rel_path("http://discuss.visual-prolog.com/viewforum.php?",[],"f=2"))],
                                                    1).


onPushButton1Click(_Source) = button::defaultAction:-        
        try
        httplay::httplay_GetAnswer(Answer),
        stdio::write(Answer)
        catch _ do
        stdio::write("EXCEPTION\n")
        finally
        stdio::write("END\n")
        end try,
        !.
    onPushButton1Click(_Source) = button::defaultAction.

The result is


httplay_error(simple_req(rel_path("http://discuss.visual-prolog.com/viewforum.php?",[],"f=2")),traceinfo([lineinfo("D:\\visual prolog 7.2\\pfc\\exception\\exception.pro",187),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\VIP7Kernel.dll",335583316),lineinfo("D:\\visual prolog 7.2\\pfc\\exception\\exception.pro",187),lineinfo("D:\\visual prolog 7.2\\pfc\\5xVIP\\sockbind\\msgLayerAsync\\msgLayerAsync.pro",235),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\VIP7Kernel.dll",335584085),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\vip7vpi.dll",355603857),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\vip7vpi.dll",355554599),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\vip7vpi.dll",355560525),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\vip7vpi.dll",355589556),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\vip7vpi.dll",355597247),addressinfo("C:\\WINDOWS\\system32\\USER32.dll",2117502772),addressinfo("C:\\WINDOWS\\system32\\USER32.dll",2117549284),addressinfo("C:\\WINDOWS\\system32\\USER32.dll",2117548848),addressinfo("C:\\WINDOWS\\system32\\USER32.dll",2117549404),addressinfo("C:\\WINDOWS\\system32\\USER32.dll",2117502772),addressinfo("C:\\WINDOWS\\system32\\USER32.dll",2117502998),addressinfo("C:\\WINDOWS\\system32\\USER32.dll",2117503437),addressinfo("C:\\WINDOWS\\system32\\USER32.dll",2117503504),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\vip7vpi.dll",355584137),lineinfo("D:\\visual prolog 7.2\\pfc\\vpi\\vpi.pro",270),lineinfo("D:\\visual prolog 7.2\\pfc\\application\\exe\\mainExe.pro",28),lineinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\main.pro",24),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\VIP7Kernel.dll",335583497),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\asd.exe",4959820),lineinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\main.pro",24),addressinfo("C:\\WINDOWS\\system32\\kernel32.dll",2088857719),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\asd.exe",54394898),addressinfo("",2147303424),addressinfo("C:\\WINDOWS\\system32\\kernel32.dll",2088999640),addressinfo("C:\\WINDOWS\\system32\\kernel32.dll",2088857728),addressinfo("C:\\Documents and Settings\\Marina\\&#1052;&#1086;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1099;\\Visual Prolog Projects\\asd\\Exe\\asd.exe",4959760)],[descriptor(classinfodescriptor("5xVIP/sockbind/msglayer/msgLayerAsync","Version 1.0"),exceptiondescriptor(classinfodescriptor("com/visual-prolog/5xVip/sockbind/sockbind","Version 1.1"),"exceptionSckGeneral","A general socket exception"),raised(),[namedvalue("socket_error_code",integer(11004))],129260183841093750,"A general socket exception",2840)],"Microsoft Windows XP OS version not supported or bad data. Service Pack 3 (Build 2600)\nNumber Of Processors: 1  PageSize: 4096  Processor: 586 level: 15 revision: 516\nProcessorNameString:               Intel(R) Pentium(R) 4 CPU 2.00GHz\nVendorIdentifier: GenuineIntel\nIdentifier: x86 Family 15 Model 2 Stepping 4\n~MHz: 1997"))

What am I doing wrong?
Besides, is there any book with all the information about all classes, packages etc? I've got dozens of questions about threads, sockets, graphics etc and all the answers i can get is some code from installed examples,
thanks.
Back to top
View user's profile Send private message
drspro2



The Netherlands
Joined: 28 Apr 2006
Posts: 168

PostPosted: 12 Aug 2010 12:00    Post subject: Reply with quote

in the tools section there is an example of Gildas wich fetches pictures from the internet url,

maybe u can use that project ,


that project succesfully gets url content
Back to top
View user's profile Send private message
Timmy




Joined: 10 Aug 2010
Posts: 7

PostPosted: 12 Aug 2010 13:23    Post subject: Reply with quote

I can get the URL content to file using URLDownloadtoFile from urlmon.lib, but I want to have it in memory
Back to top
View user's profile Send private message
Timmy




Joined: 10 Aug 2010
Posts: 7

PostPosted: 13 Aug 2010 9:24    Post subject: Reply with quote

Done it using wininet.dll, thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog Tips & Samples All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum