Reputation: 6051
I'm trying to connect to a remote webpage with curl.
$ch = curl_init(API_URL);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$params);
curl_setopt($ch,CURLOPT_TIMEOUT,30);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$response = trim(curl_exec($ch));
$params="SomeVariable=תפוח";
It doesn't work, the remote server probably doesn't get the request the way I wanted.
I sniffed with WireShark and I got this: SomeVariable=\327\252\327\244\327\225\327\227
.
I wasn't able to find out what exactly is that string.
What do you think?
Upvotes: 0
Views: 708
Reputation: 449425
You need to URLencode your post data.
$data = urlencode("תפוח");
$params = "someVariable=".$data;
Upvotes: 1