Jump to content

PHP Curl Problem


madhavvyas

Recommended Posts

I have sequence of operation so using CURL I am doing but in last step of my sequence I need to download one file.

 

when I refer same url in any browser

it will open regular  Open,save dialog box(force -download dialog like you want to save or open in any application)

 

Now my question is How can I download file using CURL in my local host  without providing response in that dialog box.(If in dialog box I say save then It will save but I want this thing using CURL)

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/105965-php-curl-problem/#findComment-544537
Share on other sites

Hello friends

 

 

Most of the part solved now only one question

If I want to POST

following kind of data  but I am not able to post array It is not passed

 

My Post data

Array

(

    [filetype] => tab

    [cateogry] => ALL

    [manufacturer] => ALL

    [invtype] => both

    [columndata] => Array

        (

            [0] => sku

            [1] => sdesc

            [2] => qty

            [3] => price

            [4] => map

            [5] => mrp

            [6] => mfgn

            [7] => mfg

            [8] => upc

            [9] => cat

            [10] => wt

            [11] => fdesc

            [12] => acc

            [13] => pi

            [14] => wa

            [15] => ti

            [16] => imgpath

            [17] =>

            [18] =>

            [19] =>

            [20] =>

            [21] =>

        )

 

    [input] => SUBMIT

)

 

and Post String

 

filetype=tab&cateogry=ALL&manufacturer=ALL&invtype=both&columndata=Array&input=SUBMIT

 

See in above string I am not able to post

 

columndata=Array

 

 

Thanks

dip solution

 

Link to comment
https://forums.phpfreaks.com/topic/105965-php-curl-problem/#findComment-544570
Share on other sites

serialize() not works because

foreach ($post as $var => $val) {
if($var=="columndata")
	$postFields[] = "$var=".urlencode(serialize($val));
else		
	$postFields[] = "$var=$val";
}

curl_setopt($conn, CURLOPT_URL, $url);
curl_setopt($conn, CURLOPT_POST, count($post));
curl_setopt ($conn, CURLOPT_POSTFIELDS, join("&",$postFields));
$page = curl_exec ($conn);

Link to comment
https://forums.phpfreaks.com/topic/105965-php-curl-problem/#findComment-544585
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.