1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Issuing an http request via c

Discussion in 'C' started by yudazdk, Oct 7, 2006.

  1. yudazdk

    yudazdk New Member

    Joined:
    Oct 6, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    Can you share the exact code that is not working.
     

Share This Page