Unknown path components using PHP to post - exception

I adapted the Social Cafe PHP to post news as read everytime a user access to an article.
Everytime I access the page, it presents this error:
Unknown path components: /mv-news:read
The code is this:
try {
$urlartigo = get_permalink();
$story_id = $facebook->api('/me/mv-news:read?article='.$urlartigo.'','POST');
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
}
mv-news is a correct namespace.
EDIT: I've just tried to use news.reads?article= and still get the same error. This is driving me crazy, as I've searched throughout the whole internet and haven't found a solution.
EDIT2: I've just changed the $story_id line of code to:
$story_id = $facebook->api('/me/mv-news:news.reads','post', array('article' => $urlartigo));
But it still outputs the same error.
enter code here

Related

How to make Custom 404 err page without .htaccess file [duplicate]

I want to show the 404 page when user enters unknown address like on the above image.
I can control the unknown address after index.php but don't know how to do this for the part before the index.php part.
I wrote this code to control what user enters after index.php
<?php
$pageName = 'places';
if (isset($_GET['page'])) {
$pageName = $_GET['page'];
}
$pageList = array(
'places',
'places_info',
'save'
);
if (!in_array($pageName, $pageList)) {
$pageName = '404';
}
?>
It looks like you have apache on your development machine.
The way to have custom error pages is
Create/Edit the file in C:\xampp\htdocs\blit\.htaccess
Insert a line ErrorDocument 404 /blit/404.shtml
Create the file C:\xampp\htdocs\blit\404.shtml
Put whatever html you want in it.
Repeat for other errors.
If you type in localhost/blit/xxy and xxy.php and xxy.html do not exist then the error page will be shown.

Refused to get unsafe header "x-parse-job-status-id" - AngularJs and Parse Server

After months of working without any trouble, now when trying to make login, this error appears. The code shown is simplified, when it arrives at "Parse.User.logIn" is when the error happens. There are some similar questions here, but all of them are related to CORS, and I don´t know how or where to make something like the line below:
Access-Control-Expose-Headers: x-parse-job-status-id
CODE:
$scope.signin = function () {
var email = $scope.login.email;
var pass = $scope.login.pass;
Parse.User.logIn(email, pass, {
success: function (user) {
Stuff after successful login
}
});
},
error: function (user, error) {
stuff after unsuccessful login
}
});
}
}
Any help would be appreciated.
Fix can be found here. We tried it and worked like a charm 👍
https://github.com/parse-community/Parse-SDK-JS/issues/622
Edit:
Solution (can be found in link)
"I believe you're using the unpkg version:
https://unpkg.com/parse/dist/parse.js, and the minified production version is at https://unpkg.com/parse/dist/parse.min.js.
Which is automatically pointing to the latest release, you should use:
https://unpkg.com/parse#1.11.1/dist/parse.js
As you are now pointing to the SDK v2.0 which contains that issue."

Magento Front End 404 Error

I am a newbie to magento, I have installed and put a few products, but then later I was getting Error:404 page not found in the front end. Backend is all OK, I am able to access everything but all of a sudden I don't know how this happened. I tried all the solutions like Flush Cache, replacing .htaccess, is_active field in database etc but all proved futile. Then lately I have put in system->Configuration->Web Base_url as http://sportiva.no/index.php/ (Previously it was http://sportiva.no/) and all is completely changed all the styles went away and I am not able to save anything. Please help, I am ready to give backend credentails.
Please help
Go to System > Configuration > Web > Default Pages and check "CMS Home Page" field value. If it is "404 Not Found", then change it to any of the CMS page available on the drop-down and save the configuration.
Refere to this link by Alan Storm,
http://magento-quickies.alanstorm.com/post/6462298634/404-debugging
excerpt from it,
Put this code in function _validateControllerClassName
<?php
#File: app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
/**
* Generating and validating class file name,
* class and if evrything ok do include if needed and return of class name
*
* #return mixed
*/
protected function _validateControllerClassName($realModule, $controller)
{
$controllerFileName = $this->getControllerFileName($realModule, $controller);
if (!$this->validateControllerFileName($controllerFileName)) {
var_dump($controllerFileName);
return false;
}
$controllerClassName = $this->getControllerClassName($realModule, $controller);
if (!$controllerClassName) {
var_dump($controllerClassName);
return false;
}
// include controller file if needed
if (!$this->_includeControllerClass($controllerFileName, $controllerClassName)) {
var_dump($controllerFileName . '----' . $controllerClassName);
return false;
}
return $controllerClassName;
}

The html page not showing correct link when using htmlunit driver

I have written a selenium script which runs in java :
String pageName = "my test url which invloves an link to html which has javscript excution";
logger.log(Level.INFO,"Page name : " + pageName);
WebDriver driver = new HtmlUnitDriver(true);
logger.log(Level.INFO,"driver instance created " );
String str ="";
logger.log(Level.INFO,"opening the url now.... " );
driver.get(pageName);
logger.log(Level.INFO,"url is now opened :: url = "+driver.getCurrentUrl());
logger.log(Level.INFO,"driver now going to sleep = "+driver.getCurrentUrl());
Thread.sleep(150000);
logger.log(Level.INFO,"Wake up from sleep now....");
logger.log(Level.INFO,"URL ::"+driver.getCurrentUrl());
logger.log(Level.INFO,"PageSource ::"+driver.getPageSource());
try {
logger.log(Level.INFO,"Driver going to wait now...");
driver.wait(100000);
logger.log(Level.INFO,"Driver came out of wait now normally...");
} catch (Exception e) {
logger.log(Level.INFO,"Driver came out of wait now exception::"+e);
}
logger.log(Level.INFO,"driver instance task completed " );
logger.log(Level.INFO,driver.getCurrentUrl());
logger.log(Level.INFO,driver.getCurrentUrl());
logger.log(Level.INFO,str);
driver.close();
Now when I debug this code I get my proper result but when I run this piece of code from servlet I get only the html content not the proper content which is excepted to come from the given link.
I also tried using the firefox driver and the same code works fine with it.
I also tried the same code with Web client but the same problem is coming.
Can anyone help me with this exception?
Thanks,
When you debug the code, you can halt at checkpoints. But you cannot stop browser from loading. It loads itself independently.
Htmlunitdriver pagesource returns all html contents as it cannot execute javascript completely.If the htmlpage contains Ajax, javascript calls then it shows the calls as it is .

denied due to lack of policy file permissions

I can't get my Yahoo! Application Platform to run I keep getting denied access even though their policy file accepts requests from any domain.
OK: Policy file accepted: http://social.yahooapis.com/crossdomain.xml
Error: Request for resource at http://social.yahooapis.com/v1/user/<user id>/profile?oauth_signature_method=HMAC-SHA1&lang=en-US&oauth_consumer_key=<key>&oauth_token=<long ass token>&oauth_version=1.0&format=json&oauth_nonce=<blah blah>&oauth_timestamp=1262846353&region=US&oauth_signature=<foo bar> by requestor from http://<my domain>/YOSSimple.swf is denied due to lack of policy file permissions.
The url works btw, I editted some stuff out since it has my keys and stuff.
Links to the stuff I'm trying to do
http://developer.yahoo.com/flash/yos/
http://developer.yahoo.com/flash/yos/examples/simple/YOSSimple.fla
YOSSimple properly creates the url actually since if I type it in my browser I'm prompted if I want to download the file that contains information regarding my profile.
But it just wont open it in Flash.
I'm guessing that it's not loading the policy file automatically. You should try using
Security.loadPolicyFile("http://social.yahooapis.com/crossdomain.xml");
Do you have a webproxy installed with which you can monitor what files exactly are loaded? My favorite is Charles but there are also free FF plugins like Httpfox
EDIT:
I think I know what's going wrong. It's going wrong the other way around, the swf from yahoo is trying to access your swf, but doesn't have the correct permissions. Would you try
Security.allowDomain( 'http://social.yahooapis.com/' );
http://www.ieinspector.com/httpanalyzer/
use HTTP analyzer to see whats happening?
also check your not missmatching http://www. with http:// because flash treats them as different domains
also are you running the code locally on your machine. It could be your local security settings
A simple WebProxy will fix this:
<?php
// PHP Proxy
// Loads a XML from any location. Used with Flash/Flex apps to bypass security restrictions
// usage: proxy.php?url=http://mysite.com/myxml.xml
$session = curl_init($_GET['url']); // Open the Curl session
curl_setopt($session, CURLOPT_HEADER, false); // Don't return HTTP headers
curl_setopt($session, CURLOPT_RETURNTRANSFER, true); // Do return the contents of the call
$xml = curl_exec($session); // Make the call
header("Content-Type: text/xml"); // Set the content type appropriately
echo $xml; // Spit out the xml
curl_close($session); // And close the session
?>
Modify the web proxy example above to support multiple options as follows:
$sOptions = "";
foreach($_GET as $sIndex => $sValue) {
if ($sIndex == 'url') {
$url = $sValue;
}
else {
if (strlen($sIndex) > 0) {
$sOptions .= "&" . $sIndex;
}
if (strlen($sValue) > 0) {
$sOptions .= "=" . $sValue;
}
}
}
$url .= $sOptions;
$session = curl_init($url); // Open the Curl session