array( 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'content' => $params ), )); $received = file_get_contents(URL, false, $context); echo $received.'';I'm pretty sure the data I send to the server is in..." />

PHP; get post string from external url (JAVA)

I need to send string data to an external url which is an API for clients, but I always get the server sending back an error, and then I checked the log in the server which is written in JAVA, it throws an exception

"java.lang.NumberFormatException: For input string: "{"success":false,"errorCode":"500","message":"Unknown Error!","value":null,"totalPageCount":0,"footerValue":null}"

and here's my piece of php code:

$context = stream_context_create(array(

'http' => array(

'method' => 'POST',

'header' => "Content-type: application/x-www-form-urlencoded\r\n",

'content' => $params

),

));

$received = file_get_contents(URL, false, $context);

echo $received.'
';

I'm pretty sure the data I send to the server is in...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts