我得到了谁做一个基本的POST请求(我只想让它工作,之后我会添加更多的东西)以下基本的脚本:
# Variables
$URL = 'http://******:8282/api/incoming_shipment/';
$postdata = http_build_query(
array(
'contract_id' => 'Showcare-R124276',
'shipment_from' => 'Montréal',
'shipment_to' => 'Chicago',
'shipping_time' => '2012-08-16 14:51:01',
'tracking_cie' => 'Poste Canada',
'tracking_type' => 'Standard',
'tracking_number' => 'EP645 9834 123 9773'
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents($URL, FALSE, $context);
print_r($result);
结果给我:
Warning: file_get_contents(http://******:8282/api/incoming_shipment/) [function.file-get-contents]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in D:\Inetpub\hightechhandling\api\api_push_contract.php on line 31
Fatal error: Maximum execution time of 30 seconds exceeded in D:\Inetpub\hightechhandling\api\api_push_contract.php on line 31
但是,当我去我的浏览器网页,它完美地工作。 我已经tryed卷曲和fsocketopen但没有工作过。 任何帮助吗? 谢谢..
编辑我加入set_time_limit (500);
现在第二个错误具有disapear当然......但首先仍然存在。