htaccess für httpGet/Post
git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3392 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
28ebfa1b85
commit
53b84270df
1 changed files with 7 additions and 3 deletions
|
|
@ -25,8 +25,9 @@ abstract class SternToursCrmExporter
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final function httpGet($url)
|
protected final function httpGet($url)
|
||||||
{
|
{
|
||||||
$resp = Util::httpGet($url, ['X-ApiKey: '. self::API_KEY]);
|
$auth = base64_encode("star:4w28baV8xEZa0SR4");
|
||||||
|
$resp = Util::httpGet($url, ['X-ApiKey: '. self::API_KEY, 'Authorization: Basic '.$auth]);
|
||||||
$ret = json_decode($resp['content'], true);
|
$ret = json_decode($resp['content'], true);
|
||||||
if ($ret === null)
|
if ($ret === null)
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +40,8 @@ abstract class SternToursCrmExporter
|
||||||
protected final function httpPost($context, $postData = [], $isContextFullUrl = false)
|
protected final function httpPost($context, $postData = [], $isContextFullUrl = false)
|
||||||
{
|
{
|
||||||
$url = $isContextFullUrl ? $context : self::API_URL.'/'. $context .'.json';
|
$url = $isContextFullUrl ? $context : self::API_URL.'/'. $context .'.json';
|
||||||
$resp = Util::httpPost($url, $postData, ['X-ApiKey: '. self::API_KEY], true);
|
$auth = base64_encode("star:4w28baV8xEZa0SR4");
|
||||||
|
$resp = Util::httpPost($url, $postData, ['X-ApiKey: '. self::API_KEY, 'Authorization: Basic '.$auth], true);
|
||||||
return [
|
return [
|
||||||
'content' => json_decode($resp['content']),
|
'content' => json_decode($resp['content']),
|
||||||
'location' => isset($resp['response_headers']['location'])
|
'location' => isset($resp['response_headers']['location'])
|
||||||
|
|
@ -48,4 +50,6 @@ abstract class SternToursCrmExporter
|
||||||
'success' => $resp['success'] && ($resp['status_code'] == 201)
|
'success' => $resp['success'] && ($resp['status_code'] == 201)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue