Guest MasterCJ Posted July 2, 2006 Share Posted July 2, 2006 Hello PHP freaks,I'm working on a php project and have run into some difficulty getting my post submission request to be recogonized by the targetwebsite. In this case the website is:http://www.eslteachersboard.com/cgi-bin/esljobs/index.pl?form=0(NOTE: I have recieved premission to post to the website via a program)The form to be posted to is: (Apologies for the compressed nature of the code - i did not want to alter it's original state)[code]<FORM ENCTYPE="multipart/form-data" METHOD=POST ACTION="http://www.eslteachersboard.com/cgi-bin/esljobs/index.pl?post" NAME="message" TARGET="_self"> <CENTER><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=4 BGCOLOR="#FFFFFF"><TR><TD></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=4 BGCOLOR="#FFFFFF"><TR><TH COLSPAN=2><FONT FACE="Arial"><BIG><big><b>Post ESL job in Korea</b></big><br><br><FONT COLOR="#FF0000">Requirements:<BR></b><small><small>Welcome Korean schools and recruiters!<br>Please support the high quality of contents and of traffic of this board by posting<br>detailed INDIVIDUAL job offers, including the following 7 items for <U>EACH JOB</U>:<br><P ALIGN=LEFT> 1. City where the job is located (no "All over Korea")<br> 2. SALARY<br> 3. Start date<br> 4. Work schedule<br> 5. Students level<br> 6. Airfare/Accommodations and<br> 7. Your requirements.<br></P ALIGN=LEFT>RECRUITERS: Please do not post general statements about <br>your firm or generic descriptions of your pool of job offers.<br>Sorry, but postings that do not comply will be deleted.<br>Thank you for your collaboration and best of luck.</font></small></small><br><br></BIG></FONT></TH></TR><TR><TD COLSPAN=2><FONT FACE="Arial"></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"><SMALL>School/recruiter <br>name (required):</FONT></TH><TD><FONT FACE="Courier"><INPUT TYPE=TEXT NAME="name" SIZE=40 MAXLENGTH=75></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"><SMALL>E-mail address <br>(required):</FONT></TH><TD><FONT FACE="Courier"><INPUT TYPE=TEXT NAME="email" SIZE=40 MAXLENGTH=100></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"><SMALL>City where the school<br>is located (required):</FONT></TH><TD><FONT FACE="Courier"><INPUT TYPE=TEXT NAME="subject" SIZE=40 MAXLENGTH=75></FONT></TD></TR><TR><TD COLSPAN=2 ALIGN=CENTER><FONT FACE="Arial"><STRONG></STRONG></FONT><BR><FONT FACE="Courier"><TEXTAREA COLS=80 ROWS=20 NAME="body" WRAP=VIRTUAL></TEXTAREA></FONT></TD></TR><TR><TD COLSPAN=2 ALIGN=CENTER><FONT FACE="Arial"></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"><SMALL>Optional Link URL:</FONT></TH><TD><FONT FACE="Courier"><INPUT TYPE=TEXT NAME="url" SIZE=40 MAXLENGTH=250 VALUE="http://"></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"><SMALL>Link Title:</FONT></TH><TD><FONT FACE="Courier"><INPUT TYPE=TEXT NAME="url_title" SIZE=40 MAXLENGTH=75></FONT></TD></TR><TR><TD COLSPAN=2 ALIGN=CENTER><FONT FACE="Arial"></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"></FONT></TH><TD><FONT FACE="Courier"><INPUT TYPE=TEXT NAME="imageurl" SIZE=40 MAXLENGTH=250 VALUE="Use the box below to upload a picture"></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"><SMALL>Optional Graphic Upload:</FONT></TH><TD><FONT FACE="Courier"><INPUT TYPE=FILE NAME="postgraphic" SIZE=40></FONT></TD></TR><TR><TD COLSPAN=2 ALIGN=CENTER><FONT FACE="Arial"><STRONG><FONT COLOR="#FF0000"><SMALL>To include a picture, click on the 'Browse' button above and upload one<br>JPG/GIF from your computer, MAXIMUM 120KB and 500 x 500. <big>NO LOGOS</big>, please. </font><br><br>If you'd like to have the option of deleting your post later,<BR>please provide a password (CASE SENSITIVE!):</SMALL></STRONG></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"><SMALL>Password:</FONT></TH><TD><FONT FACE="Courier"><INPUT TYPE=PASSWORD NAME="password" SIZE=40></FONT></TD></TR><TR><TH ALIGN=RIGHT><FONT FACE="Arial"><SMALL>Save Password:</FONT></TH><TD><FONT FACE="Arial"><INPUT TYPE=RADIO NAME="CookiePW" VALUE="Yes"> Yes <INPUT TYPE=RADIO NAME="CookiePW" VALUE="No"> No</FONT></TD></TR><TR><TD COLSPAN=2><FONT FACE="Arial"><HR WIDTH=75% NOSHADE></FONT></TD></TR><TR><TD COLSPAN=2 ALIGN=CENTER><FONT FACE="Arial"><INPUT TYPE=SUBMIT NAME="Preview" VALUE="Preview your Job Offer"> <INPUT TYPE=SUBMIT NAME="Post" VALUE="Post your Job Offer"></FONT></TD></TR></TABLE></CENTER></FORM>[/code]My post submission code:[code]<?phperror_reporting(E_ALL); /* VARIABLES */ $false=0; //FALSE $true=1; //TRUE $temp=-1; //temp //UNTESTED... //$i=0; /* CONNECT TO DATABASE */ $host="****"; $uname="****"; $pass="****; $database="****"; $tablename="mark"; $connection= mysql_connect($host,$uname,$pass); if(!$connection) { die("Database connection failed ! <br>"); } else { echo "logged into MySQL Server ", $host, " successfully.<br>"; } $result=mysql_select_db($database); if (!$result) { die("Database could not be selected"); } else { echo "Database ", $database, " ready to be used.<br><br>"; } /* USER clicked remove button */ if($_POST['submit']) { /* User did NOT eneter a job id */ if(!$jobid) { printf("you must enter a valid job id number from the database cletus!"); } /*user entered a job id number */ else { $query="SELECT jobid FROM mark"; $result=mysql_query($query); while ($row = mysql_fetch_object($result)) { if($row->jobid == $jobid) { $temp=$true; } }//while /* MAIN LOOP */ if($temp == $true){ printf("Job ID valid."); /* MARKS ESL JOB BOARD */ if($marks) { printf("You checked MARKS ESL"); /* Retrieve data from DB */ $query="SELECT * FROM mark WHERE jobid = $jobid"; $result=mysql_query($query); printf("Job Preview:"); echo "<br>--------------------------------<br>"; $id=mysql_result($result,$i,"jobid"); $name=mysql_result($result,$i,"company"); $email=mysql_result($result,$i,"email"); $location=mysql_result($result, $i, "location"); $desc=mysql_result($result,$i,"description"); $url=mysql_result($result,$i, "url"); $post="Post your Job Offer"; $reffer = "http://www.eslteachersboard.com/cgi-bin/esljobs/index.pl?form=0"; echo "<br>$id<br>$name<br>$email<br>$location<br>$desc<br>$url<br>"; /* Post data to website */ $ch = curl_init(); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); //follow any redirects curl_setopt($ch, CURLOPT_URL, "http://www.eslteachersboard.com/cgi-bin/esljobs/index.pl?post"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); //print response page /* REFFER TEST */ curl_setopt($ch, CURLOPT_REFERER, $reffer); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "Post=$post&name=$name&email=$email&subject=$location&body=$desc&url=$url"); $data=curl_exec ($ch); $c_error = curl_error($ch); $c_info = curl_getinfo($ch); curl_close ($ch); /* Print report/email report */ echo"<br> Completed CURL <br><br>"; //echo $data; echo"<br><br>"; echo 'err '.$c_error; echo"<br><br>"; echo "url ".$c_info["url"]."<br>"; echo"<br><br>"; //print_r($_POST); }//marks esl if($greenpeppers) { printf("You checked GP"); } if($onions) { printf("You checked Onions"); } if($olives) { printf("You checked Olives"); } if(!$marks && !$greenpeppers && !$onions && !$olives) { printf("You didn't check any websites to submit to cletus!"); } }//if ($temp == true) }//else }//submit[/code]The target website reports the following error's: - Incomplete Submission! - "Your message is incomplete! Your enthusiasm is appreciated, but you need to make sure that you include at least your name and a subject line! Please return to the entry form and try again. Thanks!"I would speculate the submission data has not been recieved, but asa new php programmer I am unsure of what the real problem is: - a ENCTYPE="multipart/form-data" issue - a incorrect post submission statement ( curl_setopt($ch, CURLOPT_POSTFIELDS,...); - i'm missing something about php/curl Things I have tested (using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7): - submitted to the site manually (It works!) - disabled cookies and attempted to post manually(the target website doesn't enforce cookies) - verified submission was done (i don't trust no one and it worked) - created a php file which accepted postings to it, and then SQLed the data into a DB (using the above php code) - enabled error checking (no errors) - drank a cup of green tea, and thought really long and hard about what i could do, and experiemented with many curl_setopt's (to no avail)To clarify: - My submission code is not working! The website does not seem to recieve the post submission data. I am posting to http://www.eslteachersboard.com/cgi-bin/esljobs/index.pl?post. - I am new at PHP, and have hit a deadend. This code has not been changed to any affect for the last 4 days of reading/experiementing... help!Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/13433-submitting-post-request/ Share on other sites More sharing options...
MasterCJ Posted July 4, 2006 Share Posted July 4, 2006 I am still confounded as to the issue causing my problem. I am new to PHP and need help, please!Thanks Freaks Link to comment https://forums.phpfreaks.com/topic/13433-submitting-post-request/#findComment-52711 Share on other sites More sharing options...
sprinkles Posted July 4, 2006 Share Posted July 4, 2006 If you can (with a Firefox extension), look at the headers after you've submitted the form to see if the problem lies in the form, or the php. Link to comment https://forums.phpfreaks.com/topic/13433-submitting-post-request/#findComment-52712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.