Python to PHP - Azure Machine LearningPhp

Кемеровские программисты php общаются здесь
Anonymous
Python to PHP - Azure Machine Learning

Сообщение Anonymous »

Привет, я пытаюсь перевести этот сценарий Python на PHP. У меня мало знаний о Python и ограничено для Php. < /P>

Скрипт Python: < /p>

import urllib2
import json

data = {
"Inputs": {
"input1": {
"ColumnNames": ["Client_ID"],
"Values": [ [ "0" ], [ "0" ], ]
},
},
"GlobalParameters": {}
}

body = str.encode(json.dumps(data))

url = 'https://ussouthcentral.services.azureml ... tails=true'
api_key = 'abc123'
headers = {'Content-Type':'application/json', 'Authorization':('Bearer '+ api_key)}

req = urllib2.Request(url, body, headers)

try:
response = urllib2.urlopen(req)
result = response.read()
print(result)
except urllib2.HTTPError, error:
print("The request failed with status code: " + str(error.code))
print(error.info())
print(json.loads(error.read()))
< /code>

В попытке попытаться преобразовать его сам, вот что я сделал до сих пор: < /p>



Подробнее здесь: https://stackoverflow.com/questions/294 ... e-learning

Вернуться в «Php»