Avatar of dedikate
dedikate

asked on 

How to submit java forms with PHP CURL

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 form
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");

Open in new window

PHPJava

Avatar of undefined
Last Comment
dedikate
SOLUTION
Avatar of MMDeveloper
MMDeveloper
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of dedikate
dedikate

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo