How to Post to .aspx using Curl in php

Started on the old forum in January 2012 · view the original in the archive · old links redirect here

6 replies · 2,301 views · started 14 years ago · 1 min read

2 participants
sabin14 Newbie · 6 posts #1

I want to post to .aspx using php in curl. The site does not require cookie. I tried as normal curl positng and It didnt post. can anyone provide me the code?

Show me your ways, LORD, teach me your paths. Guide me in your truth and teach me, for you are God my Savior (Psalm 25:4)

GumSlone Administrator Principal · 1,690 posts #2

sabin14 wrote: I want to post to .aspx using php in curl. The site does not require cookie. I tried as normal curl positng and It didnt post. can anyone provide me the code?

the same way like you post to php using php curl

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

sabin14 Newbie · 6 posts #3

I Tried . but it is not posting .

http://mysite.com/example.aspx I want to post in this fashion

I should get +1 as the result on screen for posting

please help

Show me your ways, LORD, teach me your paths. Guide me in your truth and teach me, for you are God my Savior (Psalm 25:4)

GumSlone Administrator Principal · 1,690 posts #4

sabin14 wrote: I Tried . but it is not posting .

http://ubaid.tk/sms/sms.aspx?uid=9746674889&pwd=password&phone=9746674889&msg=hjgyjgKJKJK&provider=way2sms&send=SEND I want to post in this fashion

I should get +1 as the result on screen for posting

please help

i think you dont even need to send a post request a simple get would work too:

$url = 'your url goes here';
$contents = file_get_contents();
echo $contents;

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

sabin14 Newbie · 6 posts #5

my host doesnot file_get_contents. Can u please provide the curl code.

Show me your ways, LORD, teach me your paths. Guide me in your truth and teach me, for you are God my Savior (Psalm 25:4)

GumSlone Administrator Principal · 1,690 posts #6
$url = 'your url goes here';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Connection: Close'));       
$contents = curl_exec($ch);
curl_close($ch);
echo $contents;

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

sabin14 Newbie · 6 posts #7

Thank u very much. It worked.

Show me your ways, LORD, teach me your paths. Guide me in your truth and teach me, for you are God my Savior (Psalm 25:4)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close