Page 1 of 1

viewing curl options

Posted: Wed Sep 13, 2006 6:24 am
by raghavan20
let us say we created a curl resource and set options on it. we can see whether option is set or not by printing return of curl_setopt() but I want to know all the options that have been set a curl resource at any point of time, how do I do that?
for ex:
if i have set CURLOPT_URL
CURLOPT_POST
CURLOPT_POSTDATA
CURLOPT_FOLLOWLOCATION

i want some way to list all the options set on a given curl resource....how?

Posted: Wed Sep 13, 2006 7:22 am
by raghavan20
2. this simple curl code does not seem to POST but it reaches the target URL...can you tell me why?

Code: Select all

$ch = curl_init( 'http://sitename/curlTest/getPOST.php' );
curl_setopt( $ch, "CURLOPT_POST", 1 );
curl_setopt( $ch, "CURLOPT_POSTFIELDS", "fileName=uploadthisfile&size=23+Bytes" );
curl_setopt( $ch, "CURLOPT_RETURNTRANSFER", 1 );
echo curl_exec( $ch );
if (curl_errno($ch)) {
 	print curl_error($ch);
}
target file code

Code: Select all

<?php
echo "\n\nprinting the received post array:\n"; print_r( $_POST );

?>
result

Code: Select all

printing the received post array:
Array
(
)
1

Posted: Wed Sep 13, 2006 7:46 am
by raghavan20
i have solved the second one, the problem was i have put double quotes around options which is not allowed.

Posted: Wed Sep 13, 2006 2:08 pm
by feyd
uh, you could just keep track of the settings you use.

Posted: Wed Sep 13, 2006 2:17 pm
by raghavan20
but i want to know whether the option set has been accepted or not. because the second problem, where i put curl options in double quotes, it returned boolean 1 but it was supposed to give 0 for those..i cant really rely ont hte output of curl_setopt()