Welcome, Guest. Please login or register.

Author Topic: Example of C source code for getting web page.  (Read 8431 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline AmigaEdTopic starter

  • His Dudeness, El Duderino
  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 512
    • Show all replies
Example of C source code for getting web page.
« on: January 21, 2006, 02:57:04 AM »
Hello,
I'm trying to learn C and I am wondering if someone out there might have a very simple example of some C source code that will grab a web page and display it or even just save it as a file.

I've looked at a few programs on aminet, but I can't seem to make sense out of them.

Thank you,
AmigaEd
"Pretty soon they will have numbers tattooed on our foreheads." - Jay Miner 1990

La Familia...
A1K - La Primera Dama -1987
A1K - La Princesa- January 2005
A2K - La Reina - February 2005
A2K - Doomy - March 2005
A500 - El Gran Jugador - April 2005
A1200 - La Hermosa Vista - May 2005
A2KHD - El Duro Grande - May 2005
A600 - Prístino - May 2005
A1200 - El Trueno Grande - July 2005
CDTV - El Misterioso - August 2005
C64 - El Gran Lebows
 

Offline AmigaEdTopic starter

  • His Dudeness, El Duderino
  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 512
    • Show all replies
Re: Example of C source code for getting web page.
« Reply #1 on: January 21, 2006, 03:59:38 AM »
Quote
by koaftder on 2006/1/20 22:05:10
This isnt too bad achttp://www.google.com/search?hl=en&q=software+hut&btnG=Google+Searchtually. Learn your tcp library. All you have to do is issue one simple string. something like "GET HTTP 1.0 /"


Hi koaftder,
The link you posted seems to take me to a bunch of links to software hut on google.

Can you please post the link again or point me to the correct site.

Thank you,
AmigaEd



"Pretty soon they will have numbers tattooed on our foreheads." - Jay Miner 1990

La Familia...
A1K - La Primera Dama -1987
A1K - La Princesa- January 2005
A2K - La Reina - February 2005
A2K - Doomy - March 2005
A500 - El Gran Jugador - April 2005
A1200 - La Hermosa Vista - May 2005
A2KHD - El Duro Grande - May 2005
A600 - Prístino - May 2005
A1200 - El Trueno Grande - July 2005
CDTV - El Misterioso - August 2005
C64 - El Gran Lebows
 

Offline AmigaEdTopic starter

  • His Dudeness, El Duderino
  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 512
    • Show all replies
Re: Example of C source code for getting web page.
« Reply #2 on: January 21, 2006, 05:39:56 AM »
Quote
by ChaosLord on 2006/1/20 23:32:26
The word "Amiga" does not exist on that site.


I agree I looked that site all over and could find no reference to "Amiga".

I really need some code that I can compile and run on an Amiga. Linux is just not an option for me right now.

Best Regards,
AmigaEd
"Pretty soon they will have numbers tattooed on our foreheads." - Jay Miner 1990

La Familia...
A1K - La Primera Dama -1987
A1K - La Princesa- January 2005
A2K - La Reina - February 2005
A2K - Doomy - March 2005
A500 - El Gran Jugador - April 2005
A1200 - La Hermosa Vista - May 2005
A2KHD - El Duro Grande - May 2005
A600 - Prístino - May 2005
A1200 - El Trueno Grande - July 2005
CDTV - El Misterioso - August 2005
C64 - El Gran Lebows
 

Offline AmigaEdTopic starter

  • His Dudeness, El Duderino
  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 512
    • Show all replies
Re: Example of C source code for getting web page.
« Reply #3 on: January 21, 2006, 12:45:16 PM »
@koaftder,
Hey no problem, no need to be sorry. All of the information that you have posted has been very helpful and I'm sure that eventually I will also give this a try on windoze or unix (for work purposes of course ) ;-)

Best Regards,
AmigaEd
"Pretty soon they will have numbers tattooed on our foreheads." - Jay Miner 1990

La Familia...
A1K - La Primera Dama -1987
A1K - La Princesa- January 2005
A2K - La Reina - February 2005
A2K - Doomy - March 2005
A500 - El Gran Jugador - April 2005
A1200 - La Hermosa Vista - May 2005
A2KHD - El Duro Grande - May 2005
A600 - Prístino - May 2005
A1200 - El Trueno Grande - July 2005
CDTV - El Misterioso - August 2005
C64 - El Gran Lebows
 

Offline AmigaEdTopic starter

  • His Dudeness, El Duderino
  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 512
    • Show all replies
Re: Example of C source code for getting web page.
« Reply #4 on: January 21, 2006, 04:08:29 PM »
Hi Piru,
We know you are the Amiga Code master.
How about showing us the correct way to do it.

Thank you,
AmigaEd
"Pretty soon they will have numbers tattooed on our foreheads." - Jay Miner 1990

La Familia...
A1K - La Primera Dama -1987
A1K - La Princesa- January 2005
A2K - La Reina - February 2005
A2K - Doomy - March 2005
A500 - El Gran Jugador - April 2005
A1200 - La Hermosa Vista - May 2005
A2KHD - El Duro Grande - May 2005
A600 - Prístino - May 2005
A1200 - El Trueno Grande - July 2005
CDTV - El Misterioso - August 2005
C64 - El Gran Lebows
 

Offline AmigaEdTopic starter

  • His Dudeness, El Duderino
  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 512
    • Show all replies
Re: Example of C source code for getting web page.
« Reply #5 on: January 22, 2006, 03:57:36 AM »
@Piru,
Thank you for posting the code.

When I try to compile the code I get an error. Here is the compiler log....

Compiler: m68k-AmigaOS
Executing  m68k-amigaos-gcc.exe...
m68k-amigaos-gcc.exe "C:\CrossCompiler\AmiDevCpp\MyAmigaCProjects\GetWebPageExamples\Piru's example\PirusExample.c" -o "C:\CrossCompiler\AmiDevCpp\MyAmigaCProjects\GetWebPageExamples\Piru's example\PirusExample.exe"    -I"C:\CrossCompiler\AmiDevCpp\usr\local\amiga\m68k-amigaos\sys-include"  -I"C:\CrossCompiler\AmiDevCpp\usr\local\amiga\m68k-amigaos\include"  -I"C:\CrossCompiler\AmiDevCpp\usr\local\amiga\include\g++-3"   -L"C:\CrossCompiler\AmiDevCpp\usr\local\amiga\m68k-amigaos\lib" -L"C:\CrossCompiler\AmiDevCpp\usr\local\amiga\m68k-amigaos\lib\libnix"
In file included from /usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/sys-include/clib/alib_protos.h:22,
                 from C:\CrossCompiler\AmiDevCpp\MyAmigaCProjects\GetWebPageExamples\Piru's example\PirusExample.c:23:
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/sys-include/devices/timer.h:30: error: redefinition of `struct timeval'
Execution terminated



I can't quite figure out what is going on.

IF I comment out the...
#include
then I can get it to compile and it seems to work.

Thank you,
AmigaEd
"Pretty soon they will have numbers tattooed on our foreheads." - Jay Miner 1990

La Familia...
A1K - La Primera Dama -1987
A1K - La Princesa- January 2005
A2K - La Reina - February 2005
A2K - Doomy - March 2005
A500 - El Gran Jugador - April 2005
A1200 - La Hermosa Vista - May 2005
A2KHD - El Duro Grande - May 2005
A600 - Prístino - May 2005
A1200 - El Trueno Grande - July 2005
CDTV - El Misterioso - August 2005
C64 - El Gran Lebows
 

Offline AmigaEdTopic starter

  • His Dudeness, El Duderino
  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 512
    • Show all replies
Re: Example of C source code for getting web page.
« Reply #6 on: January 22, 2006, 03:35:18 PM »
@uncharted,
Hey that is a pretty nice tutorial, just what a newbie like me needs...  :-D

Thank you,
AmigaEd
"Pretty soon they will have numbers tattooed on our foreheads." - Jay Miner 1990

La Familia...
A1K - La Primera Dama -1987
A1K - La Princesa- January 2005
A2K - La Reina - February 2005
A2K - Doomy - March 2005
A500 - El Gran Jugador - April 2005
A1200 - La Hermosa Vista - May 2005
A2KHD - El Duro Grande - May 2005
A600 - Prístino - May 2005
A1200 - El Trueno Grande - July 2005
CDTV - El Misterioso - August 2005
C64 - El Gran Lebows
 

Offline AmigaEdTopic starter

  • His Dudeness, El Duderino
  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 512
    • Show all replies
Re: Example of C source code for getting web page.
« Reply #7 on: January 22, 2006, 06:04:48 PM »
Yes, I also meant nice tutorial as in "easy to follow".

Piru, I understand part of the bugs you are talking about and the other half I'm lost. That's o.k. though... I'm learning and that is the important part.

I hope that someday I will be able to write some C code that works, is mostly bug free and is useful.

Best Regards,
AmigaEd


"Pretty soon they will have numbers tattooed on our foreheads." - Jay Miner 1990

La Familia...
A1K - La Primera Dama -1987
A1K - La Princesa- January 2005
A2K - La Reina - February 2005
A2K - Doomy - March 2005
A500 - El Gran Jugador - April 2005
A1200 - La Hermosa Vista - May 2005
A2KHD - El Duro Grande - May 2005
A600 - Prístino - May 2005
A1200 - El Trueno Grande - July 2005
CDTV - El Misterioso - August 2005
C64 - El Gran Lebows