2012-08-13 50 views
1

如何在不捲曲的情況下做到這一點?如何使用JSON字符串進行POST請求?

我不會有問題解析JSON字符串,但我怎麼能做一個POST請求返回一個JSON字符串包含數據?

$dataFeed=$_GET["dataFeed"]; 
$url='urlneedtopostto'; 

$data=array('data'=>$dataFeed); 
$jsonString=json_encode($data); 

我該如何發佈請求?

+0

使用file_get_contents(); Answer here:http://stackoverflow.com/questions/10668609/how-to-post-data-to-url-with-php-without-curl – MarkR 2012-08-13 09:51:17

+1

如果你想使用$ _POST你必須創建一個窗體提交它。這裏是有用的[鏈接](http://www.html-form-guide.com/php-form/php-form-submit.html) – 2012-08-13 09:52:59

+1

@JosuaMarcelChrisano其實,你不需要。在上下文中使用cURL或file_get_contents可以做同樣的事情。 – 2012-08-13 09:54:01

回答

相關問題