Weird Problem with curl while sending data

Posted on 16th Feb 2014 by admin

I am facing a weird problem with sending data to a site via curl.

If i send the value by this

Code: $data1="action=capt&tm=1256956853&tmhash=074144d43b5e2fcf34607221bd51b69dded08475&wait=30&waithash=7772647b09ec9995fc3c92d9f04be89029f80564";
curl_setopt($ch2, CURLOPT_POSTFIELDS,$data1);
It works in the above case but however if I send the values like this

Code: $data="action=".$action."&tm=".$tm."&tmhash=".$tmhash."&wait=".$wait."&waithash=".$waithash;
curl_setopt($ch2, CURLOPT_POSTFIELDS,$data);
It won't work.
Here I set $data1 from the value of $data only by getting its output on screen. So $data1 and $data are same.
Just the difference is that $data is in form of variables which I get using preg_match.
I use preg_match to get values of action,tm,tmhash and all that.

Other forums