tags:

views:

71

answers:

1

I'm trying to make cURL post to this page the data txt_code=1605120090100999. Can anyone show me the PHP code that posts that value to that page and gives me the result as output?

I tried this:

$url = 'http://195.246.54.62/support/mis_support.aspx';
$txt_code = '1605120090100999';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_COOKIEFILE,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "txt_code=$txt_code");

// Execute...
$output = curl_exec($ch);
echo $output;

but it gave me the page without post

+1  A: 

curl_exec — Perform a cURL session Returns TRUE on success or FALSE on failure. However, if the CURLOPT_RETURNTRANSFER option is set, it will return the result on success, FALSE on failure.

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

EDITed for the actual answer

Zane Edward Dockery
i know all thatbut i can not do that of that specific page
moustafa
@Zane, it might be worth it to note the change specifically he should make first: change `"txt_code=$txt_code"` to `array('txt_code'=>$txt_code)`
Mike Sherov
Yeah, I realized now that he just needs the RETURNTRANSFER option set.
Zane Edward Dockery
i want a code give me the page with the resurts okcan you understand or not
moustafa
@moustafa It seems like `RETURNTRANSFER` is what you want; is that not working?
Michael Mrozek