I have updated OS X's outdated OpenSSL 0.9.8, and updated cURL to use the new OpenSSL. I have a PHP form where I can upload a picture and I need to run my PHP cURL code on the command line.
I have found many sites that deal with converting command line cURL to PHP, but none that will do the reverse.
...//some other code
$postfields = array(
'file' => '@' . $filedata
. ';filename=' . $filename
. ';type=' . $mimeType
);
$ch = curl_init($url);
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_VERBOSE => TRUE,
CURLOPT_HEADER => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_UPLOAD => TRUE,
CURLOPT_FOLLOWLOCATION => TRUE,
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_HTTPHEADER => array(
'Content-Type: '. $mimeType,
'Session-Id: ' . getSessionId($profileID)
),
CURLOPT_POSTFIELDS => $fullPath
));
// Send the request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $header_size);
..//more code dealing with the response
Can I package up my $ch
and drop it in a php_exec
?
Is what I want to do even possible?