Hi
I want to send data to remote server ,I have used http_post_data and cURL and even fsockopen method.
For http_post_data it has give me undefined function error.For cURL i have included curl libraries .dll file ,uncommented curl extension from php.ini file though it's giving error like curl_init() can not be initialised.
same with fsockopen method.

I just want to post data to server through http,and want to catch response,anybody can please help me?
any simple function in php which is used to post data to server?

Hi
I want to send data to remote server ,I have used http_post_data and cURL and even fsockopen method.
For http_post_data it has give me undefined function error.For cURL i have included curl libraries .dll file ,uncommented curl extension from php.ini file though it's giving error like curl_init() can not be initialised.
same with fsockopen method.

I just want to post data to server through http,and want to catch response,anybody can please help me?
any simple function in php which is used to post data to server?

What type of server are you on? If it is shared, they may have disabled URL wrappers, which means that PHP file functions cannot access HTTP. So fopen, fsockopen, file, include, file_get_contents, etc. will only be able to access local files and not URLs.

This is why CURL is usually used, as it doesn't have the security problems as include() has if URL wrappers are enabled. This can be used to include remote code.

So your best bet is getting CURL to work. You can also try a system call:

eg: exec(), shell_exec() etc.

http://www.php.net/popen
http://www.php.net/proc_open

see also:
http://pleac.sourceforge.net/pleac_php/processmanagementetc.html

eg: if you have curl on your system but you think the problem is with the PHP extension:

You can try curl executable directly:

$handle = popen('curl example.com', 'r');
$read = fread($handle, 2096);
echo $read;
pclose($handle);

example taken from: http://www.php.net/popen

This article has been dead for over six months. Start a new discussion instead.