Advertisement

07.22.2008 at 04:46AM PDT, ID: 23584757
[x]
Attachment Details

How to submit java forms with PHP CURL

Asked by dedikate in PHP Installation, PHP and Databases, New to Java Programming

Tags: , ,

I'm trying to submit a form using PHP curl. but the action url of this form is in java. the action url is something like " javascript:document.oeForm.action='/se/comp?aff=intern';setCreationDate(1216726715056); groomForm('renew')"
I'm using a php curl script that i can easily submit any other forms that have something like
<form action="test.php">. but i dont know how to submit this java script
This is what i'm getting from source.
<form name="oeForm" action="/se/Edit?aff=intern" method="post" onsubmit="document.oeForm.action='/se/comp?aff=intern';setCreationDate(1216726715056);groomForm('renew');return false;">
Please help me on this , i'm a php noob. so...
Thank you in advance

This is the php script im using to curl  and submit the formStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
function GetCurlPage ($pageSpec) {
    
    $agent = "up.b";
    $header[] = "Accept: text/vnd.wap.wml,*.*";    
       $ch = curl_init($pageSpec);
      curl_setopt($ch,     CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch,     CURLOPT_VERBOSE, 1); ########### debug
    curl_setopt($ch,     CURLOPT_USERAGENT, $agent);
    curl_setopt ($ch,     CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch,     CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch,     CURLOPT_COOKIEJAR, "cook");
    curl_setopt($ch,     CURLOPT_COOKIEFILE, "cook");
       $tmp = curl_exec ($ch);
       curl_close ($ch);
    return $tmp;
}
function PostCurlPage ($pageSpec, $data) {
    
    $agent = "up.b";
    $header[] = "Accept: text/vnd.wap.wml,*.*";    
       $ch = curl_init($pageSpec);
      curl_setopt($ch,     CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch,     CURLOPT_VERBOSE, 1); ########### debug
    curl_setopt($ch,     CURLOPT_USERAGENT, $agent);
    curl_setopt ($ch,     CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch,     CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch,     CURLOPT_COOKIEJAR, "cook");
    curl_setopt($ch,     CURLOPT_COOKIEFILE, "cook");
    curl_setopt($ch,     CURLOPT_POST, 1);
    curl_setopt($ch,     CURLOPT_POSTFIELDS, $data);
    
       $tmp = curl_exec ($ch);
       curl_close ($ch);
    return $tmp;
}
 
$first = GetCurlPage("http://mywebsite.com/");
$exp = explode("=", $first);
$id = explode("\"", $exp[16]);
 
$second = PostCurlPage("http://mywebsite.com/".$id[0], "email=test@test.com&upassword=gkhgk");
 
 
[+][-]07.22.2008 at 05:51AM PDT, ID: 22058754

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.23.2008 at 07:53AM PDT, ID: 22069941

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Installation, PHP and Databases, New to Java Programming
Tags: Linux, Php curl, java, php curl, java
Sign Up Now!
Solution Provided By: dedikate
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628