Hi all,
I'm trying to get my server to connect to a script in Second Life with PHP (that 3D game) using fopen().
This script has been tested and working on another server, however on my server I get this error:
Does anyone have any idea why this happens on my server and not on another server?
Thanks, Vincent
The PHP code:
<?php
$url = $_REQUEST["url"];
$data = "testing by me";
$params = array('http' => array
(
'method' => 'POST',
'content' => $data
));
$ctx = stream_context_create($params);
$result = fopen($url, 'r', false, $ctx);
?>
For what it's worth also the LSL (Linden Scripting Language) code ( which works anyway, just included here for completeness)
string URL = "http://www.my-personal-server.com/httptest.php";
string myurl;
key reqid;
default
{
touch_start(integer total_number)
{
reqid = llHTTPRequest(URL+"?url=", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "");
}
state_entry()
{
llRequestURL();
}
http_request(key id, string method, string body)
{
llOwnerSay(method + " = " + body);
if (method == URL_REQUEST_GRANTED)
{
llSay(0,"URL: " + body);
myurl = body;
}
else if (method == URL_REQUEST_DENIED)
{
llSay(0, "Something went wrong, no url. " + body);
}
else if (method == "GET")
{
llHTTPResponse(id,200,"Get");
}
else if (method == "POST")
{
llHTTPResponse(id,200,"Post!");
}
else
{
llHTTPResponse(id,405,"Unsupported Method");
}
}
}