I'm trying to send image and some more options to the server using curl, but I don't know why it doesn't work. Here is the code:
<?php
header('Location: https://www.reporo.com/analytics/inventory-advertiser-banner.php?clientid=xxxx&campaignid=xxxx&type=smrc');
$uploadUrl = "C:\wamp\www\autofill\demo_300x250.png";
$uploadUrl = "@$uploadUrl";
$post_data['description'] = 'Name';
$post_data['url'] = 'http://www.url.pl';
$post_data['campaignid'] = xxxxx;
$post_data['clientid'] = xxxxx;
$post_data['bannertext'] = 'some text';
$post_data['upload_smrc'] = $uploadUrl;
foreach ( $post_data as $key => $value)
{
$post_items[] = urlencode($key) . '=' . urlencode($value);
}
$post_string = implode ('&', $post_items);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_string);
curl_setopt ($ch, CURLOPT_REFERER, "https://www.reporo.com/analytics/inventory-advertiser-banner.php?clientid=xxxxx&campaignid=xxxxx&type=smrc");
curl_setopt ($ch, CURLOPT_URL, 'https://www.reporo.com/analytics/inventory-advertiser-banner-update.php');
$upload_result = curl_exec ($ch);
curl_close ($ch);
?>
Indexes in $post_data are right. The form is in the same link as CURLOPT_REFERER. Field action i form contain: inventory-advertiser-banner-update.php .
Moreover I can't login to this site using curl but when I logged before, redirect works so it should work.
Is it possible that this site site can't be used curl ? I ask because before I had problem with login which I didn't resolve and now this.
Maybe there is a way to workaround ?
Greetings.