473,414 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Post form with php cURL

cracker as in cookie.. its a long story.. Anyways, so glad I found this place.. should be fun!

trying to submit a form with php script. here is the form
[php]<form name="userdata_template_form" method="post" onsubmit="this.submit1.disabled=true;" action="LZwEzgHFOthxE8iMdzKIX;_lv=3">
<input type="hidden" name="link" value="answer">
<input type="hidden" name="did" value="10827AbPhAg">
<input type="hidden" name=".crumb" value="sd3UDKutZ">
<input type="hidden" name="textarea" value="userdatainput">
<input type="hidden" name="e" value="0">
<input type="submit" class="button" value="Submit" name="submit1">
[/php]
and here is my script.. so far I've put in to many hours on this.. Im more mainframe and unix scripting so php curl is new.. enjoy the laugh[php]
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/temp/cookie.txt");
curl_setopt($ch, CURLOPT_URL,"http://10.80.2.115/userdata.html");
curl_setopt ($ch, CURLOPT_POSTFIELDS, "link=answer&did=10827AbPhAg&.crumb=sd3UDKutZ
&textarea=userdatainput&e=0&submit1=submit");
$result = curl_exec ($ch);
curl_close ($ch);
echo $result;
?>[/php]
what I get is when the page loads the text area is populated with "userdatainput" as it should be but the submit button is not "click" - if figured cURL was posting so the button would not require "clicking"

I have also tried it from the command line with no verbose errors

Many thanks..

Cracker
Mar 26 '08 #1
7 5335
TheServant
1,168 Expert 1GB
Don't know much about curl. The code doesn't look very familiar so I'm not sure how useful we'll be. Anyway, welcome to the Scripts!

2 things:
I am presuming it's just a typo, but someone will post it soon: Is that the end of your form? You need </form> at the end.
Also, include you posted code in the correct tags. (These are located just above where you post - same line as bold, italic etc...)
Mar 26 '08 #2
hey there thank you for the input.. let me clarify my question and use the code tags.. sry bout that

I'm trying to submit a http form via a php cURL script

here is the HTML code
[HTML]
<form name="userdata_template_form" method="post" onsubmit="this.submit1.disabled=true;" action="LZwEzgHFOthxE8iMdzKIX;_lv=3">
<input type="hidden" name="link" value="answer">
<input type="hidden" name="did" value="10827AbPhAg">
<input type="hidden" name=".crumb" value="sd3UDKutZ">
<input type="hidden" name="textarea" value="userdatainput">
<input type="hidden" name="e" value="0">
<input type="submit" class="button" value="Submit" name="submit1">
</form>
[/HTML]

and here is the script
[PHP]
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/temp/cookie.txt");
curl_setopt($ch, CURLOPT_URL,"http://10.80.2.115/userdata.html");
curl_setopt ($ch, CURLOPT_POSTFIELDS, "link=answer&did=10827AbPhAg&.crumb=sd3UDKutZ
&textarea=userdatainput&e=0&submit1=submit");
$result = curl_exec ($ch);
curl_close ($ch);
echo $result;
?>
[/PHP]

when I run this script via the command line I get no errors but the form isn't submitted.

If I save the script as a .php file and open it in a web browser I can see the data is placed in the right field however the form is not submitted..

any thoughts?
Thanks
Mar 26 '08 #3
ronverdonk
4,258 Expert 4TB
Thanks Bro.

Well, I don't understood one thing.. php is todays technology :)
More faster and i believe easier then why people go to other languages such as perl and cgi and all that?

Can any one clarify it to me? Is there is any reason that those languages have some more special features then php???

Thanks..
FAISAL!
Your question has nothing to do with the problem at hand, so do not hyjack this thread!!

Thread will be split.

moderator
Mar 27 '08 #4
I guess no one understands my question.. let me give more input

The form code you see if from a web page on a remote server google.com

My server is running the cURL script to submit data to the remote server. The data is sent to the server but it doesn't seem to get processed. I know it can be done because spammers do it. I'm not spamming though.. I want to automate some google aps functions
Mar 28 '08 #5
ronverdonk
4,258 Expert 4TB
As you guessed rightly: I still do not see the goal of this excercise.

I cannot see the purpose of that form. You have a submit button, but that button is diabled, so the form cannot and will not be sent anywhere. In casse the submit button would be enabled the form would be posted to something called "LZwEzgHFOthxE8iMdzKIX;_lv=3", whatever that is.

Just to give us the basic idea: how do you envisage the form data (at the CLIENT (but generated by google.com ???) is to be transferred to the php cURL routine (at your SERVER)?

Ronald
Mar 28 '08 #6

Just to give us the basic idea: how do you envisage the form data (at the CLIENT (but generated by google.com ???) is to be transferred to the php cURL routine (at your SERVER)?

Ronald
the form data is static on google.. they are just static HTML pages with form code in them. I look at the code and use it in my script
Mar 31 '08 #7
ronverdonk
4,258 Expert 4TB
You forgot to reply on the first part of my post. When you try to do that you will see your problem.

Static HTML pages on a server are never executed on the server, they are sent to the client and executed there. So, look again at the first part of my previous post.

I bet you don't even need that html form from Google, you can just execute your curl script and it will run. You'd need at least your own form, that directs to your own curl script, to do that.

Ronald
Mar 31 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: mahesh anasuri | last post by:
Hi all, I am new to this mailing list. Thankful if any one is using curl/linux version to and worked on Https. I have created certificates (PEM format) for client and server using openSSL. I...
2
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata ...
2
by: aalmakto | last post by:
Please help, I am having trouble using curl_setopt to post to an encrypted form. The form values are <form action=save_text.cgi method=post enctype=multipart/form-data> I have isolated the...
56
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my...
13
by: trpost | last post by:
I am looking for a way to send data from one page to another as POST data without using forms or cURL. I have a php script that is passing a list of cases from on page to another when a link is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.