Solved

How do I Post with cURL?

Posted on 2009-05-10
9
364 Views
Last Modified: 2013-12-13
Hello dear expert-exchange expers,

I am trying to do something with cURL and php. I will shortly tell you what my script does.

Script can login to destination with cookie
Script can fill the form datas on destination
Script cannot submit the form because of javascript.

The code on the destination is below ;



Can someone tell me how can I do post action with curl ?

Any help would be really appreciated. Thanks
<span id="subButton" class="jsButton"><span class="first-child">
		<a href="javascript:document.storyForm.submit();">Publish</a>
		</span></span>
 
 
//////////////////////////////////////// and for action is ///////////////////////////////////////
 
<form enctype="multipart/form-data" method="post" action="/post/url/" name="storyForm">

Open in new window

0
Comment
Question by:LordoftheDreamer
9 Comments
 
LVL 5

Assisted Solution

by:cdaugustin
cdaugustin earned 25 total points
ID: 24347613
0
 
LVL 1

Accepted Solution

by:
DanielBlaze earned 75 total points
ID: 24347804
If you are using Firefox, I highly recommend the addon "Tamper Data"
This allows you to see POST and GET info, as well as destination, User Agents, Hosts, Cookies etc. etc.

Post action with cURL as follows, just remember to change the post fields to match that of the site you want to POST to:



<?PHP
curl_setopt($ch, CURLOPT_POST, 1);		
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=USERNAME&password=PASSWORD&rememberme=TRUE");
?>

Open in new window

0
 

Author Comment

by:LordoftheDreamer
ID: 24347889
Hello dear expersts,

Thank you for your comments.

@cdaugustin

I took a look that web site. I couldn't figure it out how would I configure that to my script.

@DanielBlaze

I am using Live Http Header which is like Tamper Data but it does not show the post action. The problem is that I am trying to post javascript.

The javasciprt submit code like ;
javascript:document.storyForm.submit();

You could see javascript action on first message.

I would be really so glad if someone help me out.

Thanks anyway who tried to help me.

regards,
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:DanielBlaze
ID: 24348396
cURL cannot interpret Javascript on it's own, but if you know what the Javascript is doing, you can probably work around it.

Try installing tamper data and submitting the form like you usually do manually. See what is being POSTed and where to. Then you can simply use the cURL code I gave you above to bypass the javascript and continue like normal
0
 

Author Comment

by:LordoftheDreamer
ID: 24349021
Mr. Daniel I could pay for this help. Could you let me know how can I contact to you ?
0
 
LVL 1

Expert Comment

by:DanielBlaze
ID: 24349073
Is that allowed?
If so post your email address here, and I'll contact you by email. I'll then help you over MSN messenger or something.
0
 

Author Comment

by:LordoftheDreamer
ID: 24349173
I do not know it is allowed or not but I need this help. My msn messenger ID lordofthedreamer@live.com
0
 
LVL 2

Assisted Solution

by:jccs0519
jccs0519 earned 25 total points
ID: 24358878
I think you need a wrapper around cURL.  Like suggested using php or perl or even shellscript.  Sounds like other user is helping you.  Thought I throw that in anyway.
0
 

Author Comment

by:LordoftheDreamer
ID: 24368437
Thank you everybody who tried to help me. If someone would like to talk about cURL do not hesitate to add to me your contact list.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can I make this form submit to itself? 10 35
Add email address from a web page to outlook 2010 contacts ? 8 40
mysql query for sum() 3 28
IP 10.0.1.2 / 255.0.0.0 61 56
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question