0

My wordpress plugin sends data as postrequest using WP_HTTP class of wordpress .

  $myreq = new WP_Http;   
  $myres = $myreq->request("url", array('method' => "POST", 'body' => $mydata, 'timeout' => 'some value') );

Above code working fine when data size is small.When data size is large, it is throwing error. How can I know whether the error is just because of large size programatically ? Also what is the remedy? Do I have to ask the user to change his settings so that the required amount of data can be sent as post data ? Or Is there anything that can be done in plugin to allow posting more amount of data ?

user1767962
  • 2,089
  • 4
  • 18
  • 19

1 Answers1

0

You can use the mechanism specified in this question to catch the error. Once you catch the error, you can notify the user.

Alternatively you can also use the following statement, to increase the amount of memory available to your PHP script (provided the server has enough memory)

ini_set('memory_limit','32M'); 
Community
  • 1
  • 1
Sudar
  • 18,954
  • 30
  • 85
  • 131