Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8723805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:42:17+00:00 2026-06-13T07:42:17+00:00

I am trying to send this POST request to the specified website in Objective-C,

  • 0

I am trying to send this POST request to the specified website in Objective-C, but know very little about HTML and how to format my request.

The address is: https://selfservice.mypurdue.purdue.edu/prod/bwckgens.p_proc_term_date if you want to see where I am getting this HTML source code from.

    <FORM ACTION="/prod/bwckschd.p_get_crse_unsec" METHOD="POST">
<INPUT TYPE="hidden" NAME="term_in" VALUE="201320">
<INPUT TYPE="hidden" NAME="sel_subj" VALUE="CS">
<INPUT TYPE="hidden" NAME="sel_levl" VALUE="dummy">
<INPUT TYPE="hidden" NAME="sel_schd" VALUE="dummy">
<INPUT TYPE="hidden" NAME="sel_coll" VALUE="dummy">
<INPUT TYPE="hidden" NAME="sel_divs" VALUE="dummy">
<INPUT TYPE="hidden" NAME="sel_dept" VALUE="dummy">
<INPUT TYPE="hidden" NAME="sel_attr" VALUE="dummy">
   </FORM>

I am trying to send a POST request to the address https://selfservice.mypurdue.purdue.edu/prod/bwckctlg.p_display_courses with the the field “term_in” equal to 201320 and the “sel_subj” field equal to “CS”, and the rest being dummy. How would I go about doing this?

This is what I have so far:

#import "PCFViewController.h"

@interface PCFViewController ()

@end

NSMutableData *mutData;

@implementation PCFViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)queryServer {
    NSURL *url = [NSURL URLWithString:@"https://selfservice.mypurdue.purdue.edu/prod/bwckschd.p_get_crse_unsec"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:3.0];
    [request setHTTPMethod:@"POST"];
    NSString *args = @"term_in=201320&sel_subj=CS&sel_day=dummy&sel_schd=dummy&sel_insm=dummy&sel_camp=dummy&sel_levl=dummy&sel_sess=dummy&sel_instr=dummy&sel_ptrm=dummy&sel_attr=dummy";
    NSData *requestBody = [args dataUsingEncoding:NSUTF8StringEncoding];
    [request setValue:@"text/html" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:requestBody];
    NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    [connection start];
    if (connection) {
        mutData = [NSMutableData data];
    }
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
     NSLog(@"Succeeded! Received %d bytes of data",[mutData length]);
    NSString *str = [[NSString alloc] initWithData:mutData encoding:NSUTF8StringEncoding];
    NSLog(@"%@", str);
}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    NSLog(@"%@\n", error.description);
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [mutData setLength:0];
    NSLog(@"%@\n", response.description);

}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [mutData appendData:data];
}
@end

My console shows me this output:

Succeeded! Received 213 bytes of data
2012-10-25 02:25:38.683 Purdue Course Finder[25844:c07] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>410 Gone</title>
</head><body>
<h1>Gone</h1>
/prod/bwckschd.p_get_crse_unsechas been permanently removed from this server.</p>
</body></html>

Can someone help me figure out why this is not a valid request? If a value is set to dummy, should I not add it to the string? Is the string in an incorrect format with each value being suffixed with a &? Any suggestions? Can someone get me the URL of this POST request so I can modify my code accoringly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:42:18+00:00Added an answer on June 13, 2026 at 7:42 am

    Try it in this format,

    [request setValue:@"201320" forHTTPHeaderField:@"term_in"];
    [request setValue:@"CS" forHTTPHeaderField:@"sel_subj"];
    [request setValue:@"dummy" forHTTPHeaderField:@"sel_levl"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send the xml to another webserver through Restclient's http POST request.This
I am trying to send a simple ajax post request using Mootools but I'm
I'm trying to send a POST request from iPhone to Django, but for some
I'm trying to send a POST request to a PHP script (http://mywebsite/index/test/ in this
I'm trying to send a POST request to my localhost from an Android app
I am trying to send a post request to google OAuth, and it is
I am trying to send a post request through ajax to another domain and
I m trying to send a csv file in post request and want to
i am trying to send a variable to another page with a post request
I am trying to send a POST request to a servlet. Request is sent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.