此 PHP 代码使用 SoapClient 工作。
$client = new SoapClient("http://www.roblox.com/Marketplace/EconomyServices.asmx?WSDL");
$response = $client->GetEstimatedTradeReturnForTickets(array("ticketsToTrade" => 1000));
echo $response->GetEstimatedTradeReturnForTicketsResult;
它呼应了一个数字。
我计划在 x10hosting(或任何其他具有 10 分钟 cron 的免费网络主机)上执行此操作,并且 x10hosting 不支持 SoapClient。
那么如何在不使用 Soap 的情况下编写它呢?
编辑:所以我也试过这个,但它没有用。
<?php
//
// A very simple PHP example that sends a HTTP POST to a remote site
//
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.roblox.com/Marketplace/EconomyServices.asmx/GetEstimatedTradeReturnForRobux");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,array("robuxToTrade" => 1000));
// in real life you should use something like:
// curl_setopt($ch, CURLOPT_POSTFIELDS,
// http_build_query(array('postvar1' => 'value1')));
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
echo $server_output
curl_close ($ch);
?>