Issuing an http request via c

yudazdk's Avatar, Join Date: Oct 2006
Newbie Member
Hello

OS: RedHat Linux

I have to write a c program that should issue an HTTP GET request such as the following:

http://foobar.com/Processbounce.php?remove=1 (The script updates a row
in the database table)

I tried using socket for that on port 80.
I used functions:
1) sockfd = socket(PF_INET, SOCK_STREAM, 0)
2) connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct
sizeof(struct sockaddr))
3) bytes_sent = send(sockfd, msg, len, 0) ; // msg contains the http
headers get request

The problem is that the script doesn't work. I tried many variations
of http header get request with no success.

Thanks
Yehuda
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Can you share the exact code that is not working.