try {
$return = $facebook->api("/" . $userFromDB["username"] . "/feed",
"post", array(
message => "",
picture => "http://blabla.net/blabla1/img/autopost/" . $blabla2 . ".png",
link => "http://apps.facebook.com/blabla1/?var2=" . $encryptedUserIds[$userFromDB["id"]], //$appPageURL
caption => "Tikla, begen.",
description => $var3,
access_token => $auth["auth_code"],
));
$usersPosted++;
} catch (FacebookApiException $e) {
$userProcessError++;
write_log("blabla");
}
Hello, this is the part of the code where i send posts to users' wall. If there is no exception, the code works flawlessly. Whenever an exception occures, I get this annoying fatal error.
I have tried many things to correct but the script is the same where I make calls to facebook api in other parts of my code.
I searched google and stackoverflow. Noone seems to have this error. Am i the only one? Thanks in advance.
This is the error:
Fatal error: Call to undefined method Facebook::throwAPIException() in facebook-php-sdk/src/base_facebook.php on line 870
Facebook sdk version i use: 3.2
Php version: 5.3
EDIT: this is how i get access_token for user. I store it into db:
if(isset($code) && $state==$authState){
$accessTokenInformation=file_get_contents($accessTokenURL . $code);
$tmpResult=explode("&", $accessTokenInformation);
if(sizeof($tmpResult)==2){
$tmpAT=explode("=", $tmpResult[0]);
$tmpExp=explode("=", $tmpResult[1]);
if(sizeof($tmpAT)==2 && sizeof($tmpExp)==2){
$tmpDBUserAuth=check_db_for_authcode_for_user(...);
if(empty($tmpDBUserAuth)){
insert_authcode_indb(...);
write_log(...);
}else{
update_authcode_indb(...)
write_log(...);
}
}else{
write_log(...);
echo(' top.location.href="'. $OAuthURL .'"; ');
}
}else{
write_log(...);
echo(' top.location.href="'. $OAuthURL .'"; ');
}
}
EDIT on 2012/11/06: Problem still persists. Please help.
Please check you FB API secrete keys are proper set or not ... I also faced this problem , but i have corrected secrete keys after that it was working perfect.
Try to use the following script
http://www.9lessons.info/2011/09/update-login-with-facebook-and-twitter.html
Fatal error: Call to undefined method Facebook::throwAPIException() in facebook-php-sdk/src/base_facebook.php on line 870
That error message does not make sense.
If I go to line 870 in that file in my IDE, and follow the method name to its declaration, it’s in the same file on line 1237 (all for current version 3.2.0).
So there is no plausible reason for a undefined method error there.
Could you please check if the SDK files got uploaded correctly to your server, or just re-download and re-upload them, to make sure its not a problem with mangled/truncated file contents?
Related
enter image description hereOne of my client's Opencart website have issues when open the website, a prompt alert shows following code:
Conflict
<script>document.cookie = "humans_21909=1"; document.location.reload(true)</script>
How to get this resolve. Also help me to find the files where they are located to fix it.
Had the same issue, it only happened to me when the request was something to do with "register", in my case it was "register.php", I only changed the documents name and problem was solved
You need to change the filename of register.php and its occurrences on all places in the files.
In register_modal.tpl find this part (for me 582 line):
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
Comment this alert.
Enjoy!
It might be happening because of your function name is 'register' so you need to change the function name to some other name and check it.
I am trying to assert that a few steps in the code (visiting page, providing wrong card-number, password combination and clicking submit)should generate an error from the backend service - I have referred to this already..
and tried the suggestion of using Error Object as the second argument to assert.throws but that doesn't work for me.
i did see this link as well before posting my question,
My problem is - I don't have control over the code that throws the exception/error in this case. (I cannot change it to say Ember.assert etc) I just want to be able to catch an erroneous case.
Secondly, I don't have a component in this case. Its a straight forward API call that's made when click on submit is done, basically an action submitAuthForm is called in controller which calls ember cli mirage scenario that returns the following object problems object.
return new Response(401,{'X-Auth-Token': 'wrong-username-password-combination'},failResponse401);
and the returned object looks like
var failResponse401 = {
problems: [ {
field: null,
index: null,
value: null,
code: '0006',
subCode: '',
details: {},
_type: 'error'
} ]
};
We have a node_module dependency on an in-house exceptions kit that throws an Error object based on this.
Here's my Qunit test
test('ERROR_CASE_visiting /signon, provide cardNumber(2342314) and ' +
'password, submit and expect to see invalid cardnumber/password error',
function (assert) {
assert.expect(2);
assert.throws(
function () {
visit('/signon');
fillIn('#a8n-signon-card-number input', '2342314');
fillIn('#a8n-signon-password input', 'password');
click('#a8n-signon-submit-button button');
},
Error,
"Error Thrown"
);
});
I keep getting this error from Qunit
Error Thrown# 110 ms
Expected:
function Error( a ){
[code]
}
Result:
undefined
Diff:
function Error( a ){
[code]
}defined
Source:
at Object.<anonymous> (http://localhost:7357/assets/tests.js:175:12)
at runTest (http://localhost:7357/assets/test-support.js:3884:30)
at Test.run (http://localhost:7357/assets/test-support.js:3870:6)
at http://localhost:7357/assets/test-support.js:4076:12
at Object.advance (http://localhost:7357/assets/test-support.js:3529:26)
at begin (http://localhost:7357/assets/test-support.js:5341:20)
API rejected the request because of : []# 1634 ms
Expected:
true
Result:
false
Source:
Error: API rejected the request because of : []
at Class.init (http://localhost:7357/assets/vendor.js:172237:14)
at Class.superWrapper [as init] (http://localhost:7357/assets/vendor.js:55946:22)
at new Class (http://localhost:7357/assets/vendor.js:51657:19)
at Function._ClassMixinProps.create (http://localhost:7357/assets/vendor.js:51849:12)
at Function.createException (http://localhost:7357/assets/vendor.js:172664:16)
at Class.<anonymous> (http://localhost:7357/assets/vendor.js:133592:72)
at ComputedPropertyPrototype.get (http://localhost:7357/assets/vendor.js:32450:27)
at Object.get (http://localhost:7357/assets/vendor.js:37456:19)
at Class.get (http://localhost:7357/assets/vendor.js:50194:26)
at http://localhost:7357/assets/vendor.js:133645:30
Is there anything else that i can try to get it to work.
Is there someway i could somehow pass this test, by wrapping the returned response somehow in a way that it doesn't break my test altogether.
I found a workaround following this link
the user pablobm has posted a link to a helper
I used that to workaround this Qunit issue.
I am trying to get all users who likes a specific post on a feed. I am using facebook/php-sdk-v4 . There is no problem on getting next page for feed. However when I use next function to get next users who liked that post in inner loop it gives
Error:Caused by: Facebook\Exceptions\FacebookAuthenticationException
Subfields are not supported by feed.
In FacebookRequest.php I disabled appsecret_proof, maybe it is related to this security issue. If I don't disable, it gives now invalid appsecret_proof despite v5.0 sdk already generates appsecret_proof internally at the line 70 of Facebook\Authentication\AccessToken.php.
Without appsecret_proof I am able to request but in some cases like batch query or loops I think there is a need for appsecret_proof. However, it generates that code itself and it gives invalid error. I don't know what to do.
$fb = new Facebook\Facebook([
'app_id' => '60...
]);
$feed = $graphNode->getField('feed')
while(true) {
foreach ($feed->all() as $key1 => $post) {
if ($likes = $post->getField('likes')){
while(true) {
if (!($likes = $fb->next($likes))) break;
}
}
}
if (!($feed = $fb->next($feed))) break;
}
I have a simple webservice in symfony2 that is working perfectly. I have added a new method, however, strangely, that method is not recognized, even when I see it in the WSDL definition.
Please load: WSDL definition
Method is called GetHoliday
The controller that executes that method is the following:
public function getHolidayAction() {
date_default_timezone_set('America/Santiago');
$request = $this->getRequest();
$client = new \SoapClient('http://' . $request->getHttpHost() . $request->getScriptName() . '/feriados?wsdl');
$year = $request->get('year');
$month = $request->get('month');
$day = $request->get('day');
$types = $client->__getFunctions();
var_dump($types);
die();
$result = $client->GetHoliday('8cd4c502f69b5606a8bef291deaac1ba83bb7727', 'cl', $year, $month, $day);
echo $result;
die();
}
After the call to __getFunctions call, GetHoliday method is missing.
If you want to see the __getFunctions response, please load online site
Enter any date in the input field. The response will appear in red.
The most curious thing, is that this works in my development machine which also has RedHat operating system (my hosting is HostGator).
Any help will be appreciated,
Finally, the problem was that the WSDL was being cached.
To make the first test, I used
$client = new \SoapClient('http://' . $request->getHttpHost() . $request->getScriptName() . '/feriados?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE) );
To instantiate SoapClient. That way, it worked. so to get rid of WSDL_CACHE_NONE parameter, I deleted all files that start with wsdl in /tmp folder.
Regards,
Jaime
i want to put rel=lightbox to some links that mediabox support using javascript.
i try this and wonder why it's not working?
test: http://jsbin.com/opica
please help edit this: http://jsbin.com/opica/edit
<script type="text/javascript">
var x=xmlDoc.getElementsByTagName("a");
var regexku=/^.+(((twit)|(tweet)|(com/video.+)|(flickr.com.+)|(tube.com.+))|((gif)|(jpe?g)|(png)|(flv)|(swf)|(mp3)|(mp4))$)/;
for(i=0;i<x.length;i++)
{
a=x[i].getAttribute('href');
if (a.match(regexku) != null)
{
x.item(i).setAttribute("rel","lightbox");
}
}
</script>
So if you open the Error Console (Tools -> Error Console in Firefox), you'll see two errors on your page:
Error: xmlDoc is not defined
Source File: http://jsbin.com/opica
Line: 35
Error: invalid regular expression flag v
Source File: http://jsbin.com/opica
Line: 21, Column: 38
Source Code:
var regexku=/^.+(((twit)|(tweet)|(com/video.+)|(flickr.com.+)|(tube.com.+))|((gif)|(jpe?g)|(png)|(flv)|(swf)|(mp3)|(mp4))$)/;
The later is fixed by escaping the slash as Bart suggested (com\/video).
The former says there's no such thing as xmlDoc. You probably meant the page's document, in which case you should replace it with document.
Next the whole thing probably won't work because you should run the script after the page is finished loading. In jQuery it's $(document).ready(function() { /* do your work here */ }), google how to do it using the whatever framework you're using (mootools-yui?).
After that as you can see, the rel attribute is set on the links: http://jsbin.com/elaca/edit. The fact that the whatever library you're using still doesn't work means you're using it wrong. You didn't even link to the page you've downloaded the library from so that someone could look up the documentation for you...
Try escaping the / between com and video.