Notifications
Clear all

[Closed] Send data from max to php,possible?

Hi everyone,
Is that possible embeded a php page and send data from max to php via maxscript?It seems telent maybe can handle this,I just write a small piece or part of codes ,but I don’t know how to connect them:

—————maxscript codes———————-

global test_string="Hello,world!"
rollout rphp "php_test"
( 
activeXControl ax "http://www.yoursite.com/test.php" height:200 width:300  align:#left
)
createDialog rphp 400 400

—————php codes(test.php)———————-

<?php
$get_from_max_string='';
echo $get_from_max_string;
?>

Like the example,I just want max send “Hello,wolrd!” string (global test_string) to php ($get_from_max_string),thanks in advance if anybody good at it.

2 Replies

I dont know PHP but sending any form of string should be pretty straightforward via the webclient. I’ve used requestbin as a temp website to see the result of the code, it seems like the parameters were passed correctly.

URI = "http://requestb.in/12wlbxl1"
myParameters = "get_from_max_string=Hello,world!!"

webClient = dotnetobject "System.Net.WebClient"
webClient.Headers.set ((dotnetclass "System.Net.HttpRequestHeader").contentType) "application/x-www-form-urlencoded"
HtmlResult = webClient.UploadString URI myParameters

1 Reply
(@momo2012)
Joined: 10 months ago

Posts: 0

hi,Pete,I’ve just tested,it seemed passed the data correctly like you said.I need do more test in this way of handle data with php,too much thanks and appreicate! :bowdown: