-
Notifications
You must be signed in to change notification settings - Fork 0
/
resources.php
33 lines (29 loc) · 947 Bytes
/
resources.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
function oauthServiceLoader($rInfo,$debug=false)
{
$svc = new Clickpdx\OAuth\OAuthHttpAuthorizationService();
$svc->setOAuthParams($rInfo['params']);
$svc->registerWriteHandler('POST',function($ch){
$ch->h = \curl_init($ch->getUri());
curl_setopt($ch->h, CURLOPT_HEADER, false);
curl_setopt($ch->h, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch->h, CURLOPT_POST, true);
curl_setopt($ch->h, CURLOPT_POSTFIELDS, $ch->formatPostFields());
return curl_exec($ch->h);
});
return $svc;
}
function sfRestApiServiceLoader($rInfo,$debug=false)
{
$svc = new Clickpdx\SalesforceRestApiService();
$svc->setDebug($debug);
$svc->setParams($rInfo['params']);
$svc->registerWriteHandler('POST',function(/*HttpMessage*/$ch){
$ch->h = \curl_init($ch->getUri());
curl_setopt($ch->h, CURLOPT_HEADER, false);
curl_setopt($ch->h, CURLOPT_RETURNTRANSFER, true);
$ch->addHeaders();
return curl_exec($ch->h);
});
return $svc;
}