Jump to content

[TUT] PHP SDK


FatalTerror

Do you like this tutorial ?  

115 members have voted

  1. 1. Do you like this tutorial ?

    • Yes
      102
    • No
      13


Recommended Posts

Nice tuto , it is very useful c:, but when I done the first example appear Hello Mr.Padawan this is right ? or I done something bad in this ?

Yea, you are right :)

With this example, you learn how transfer informations Site > Server.

You say to the server to get the name of your cat, the site get & return it to the server.

Link to comment
  • 5 months later...
  • 2 weeks later...

I need your help about PHP_SDK plugin.

I know how to return strings through php, so I just ask:

How can I return an image to the MTA? doReturn - returns nil all the time

I tried converting image to a string , but dxCreateTexture don't treat that string as a pixels.

Maybe do you know how to convert it so MTA will understand the code?

Also tied sending an image to a server [ftp] but my php server do not allow ftp connections.

Any clues?

Link to comment

I tried fread and file_get_contents and It seems that this is working, because when I am outputing the string version of an image I see a code in the browser, but when I am trying to send it to MTA, MTA outputs nil all the time.

<?php 
 include( "mta_sdk.php" ); 
 $input = mta::getInput(); 
 $player = $input[0]; 
 $url = $input[1]; 
  
  $str = file_get_contents($url); 
  
  mta::doReturn($player,$str); 
?> 

  
function imageURL(thePlayer,cmd,url) 
    callRemote ( "http://mywebsite.com/image.php", mail_return, thePlayer, url) 
end 
addCommandHandler("url",imageURL) 
  
function mail_return(player,str) 
    outputConsole(player) -- returns me as an element 
    outputConsole(str) -- returns always 'nil' 
end 
  

Link to comment
  • 1 month later...
  • 2 weeks later...
  • 3 years later...

With HTTP username and password you can call functions in MTA server via PHP. That needs an account on MTA server which must have special privileges. It is all explained on wiki. You don't need to fill those variables, but if you want to call function on server, you can just put username and password as arguments of SDK call function.

Link to comment
With HTTP username and password you can call functions in MTA server via PHP. That needs an account on MTA server which must have special privileges. It is all explained on wiki. You don't need to fill those variables, but if you want to call function on server, you can just put username and password as arguments of SDK call function.

Thanks so much ! :)

Link to comment
  • 2 years later...
  • 6 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...