Security error accessing url in MXML - php

I am calling http service from flex ...
<mx:HTTPService id="personRequest" url="http://111.111.1.11/idesk/user.php/userinfo" useProxy="false" resultFormat="text" result="personJSON(event)" fault="anotherMethod(event)" method="post">
<mx:request xmlns="">
<getPerson>"true"</getPerson>
</mx:request>
</mx:HTTPService>
and getting following error:
Security error accessing url
I have placed cross-domain policy file in server-script folder but it didnt solve my problem.
Any help is appreciated. Thanks in advance.

Try to use Charles to see of what flash trying to load. It will show if swf accessed crossdomain.xml from your server and correct path.

Are you loading from your file system? If so, you must be able to see in your address bar something like "file:// ..."
If that is the case, the Flash Player will not allow you to connect to servers (even though you have configured your cross-domain.xml)
You have two possible solutions to solve this problem:
Host your Flex Application in a web server (your address will look like http:[something])
Add the -use-network=false in your Flex compiler arguments.
You can find more information about Flex Compiler arguments here
I hope this helps.

Related

ESRI Resource-Proxy issue

I am working on a web application using the esri javascript api. To access cross domain resources I have to install the Resource-Proxy (https://github.com/Esri/resource-proxy). I tried to install the PHP version like described but the test call http://[yourmachine]/PHP/proxy.php?ping ended up with a blank screen and a 500 HTTP error code.
The proxy-verification.php shows that everything should work fine.
Any ideas?
Try setting mustMatch="false" in the proxy.config (just for testing)
try following in proxy.config
<ProxyConfig allowedReferers="*"
mustMatch="false">
<serverUrls>
<serverUrl url="http://path/"
matchAll="true"
username="username"
password="password"
/>
</serverUrls> </ProxyConfig>

MethodNotAllowedHttpException in RouteCollection.php line 200:

I have these route declaration here
//Skill
Route::get('skill','SkillController#index');
Route::get('skill/create','SkillController#create');
Route::post('skill/store','SkillController#store');
Route::get('skill/{id}','SkillController#show');
Route::get('skill/{id}/edit', 'SkillController#edit');
Route::post('skill/{id}/update','SkillController#update');
Route::delete('skill/{id}/destroy','SkillController#destroy');
With these routes, I can delete fine on local.
When I tried to delete on production, I kept getting
I know for sure, I had this line
Route::delete('skill/{id}/destroy','SkillController#destroy');
Local and Prod have the same codebase.
Local = Mac OS X
Prod = Ubuntu Server
What did I missed ?
The route is triggered from a form... Yes? Your form method should be POST, not DELETE and then you should add a hidden input to make it work as DELETE route, thus helping you maintain Route::delete().
Your form should look like this:
<form action="/foo/bar" method="POST">
<input type="hidden" name="_method" value="DELETE">
And your route:
Route::delete('skill/{id}/destroy','SkillController#destroy');
Read https://laravel.com/docs/5.7/routing#form-method-spoofing for more insight.
As your problem is on production only which is linux server I think it may be .htaccess issue.
Often web servers will be configured to block anything except GET and POST since 99% of the time they're all that are needed and there have been problems in the past with applications assuming the requests were one of those two.
You could try an .htaccess with
<Limit GET POST PUT DELETE>
Allow from all
</Limit>
(I'm not an expert at apache, this may not be exactly correct)
When you wrote down your request in browser address bar it supposed to be GET or POST. That's why you got the mistake.
MethodNotAllowedHttpException: It means that the route is correct, but method is mistaken. You used POST method - this method is automatic if you use browser. But you need DELETE method.
In order to use DELETE method you should use API client.
PhpStorm has API built-in API client. PHPStorm RESTApi client docs
But! For me the best way is to use Postman! Postman sending requests docs

Direct browser upload to Amazon S3

I'm trying to figure out how perform a browser direct upload to Amazon S3 using an XHR. I'm using some pre-made code that creates a signature and performs the upload. All I have to do is enter my S3 security credentials. (For what it's worth, I want to do the policy signing using PHP).
I've forked the code to my GitHub account, you can find it here: https://github.com/keonr/direct-browser-s3-upload-example
As the readme file indicates, I have set my S3 bucket CORS to allow all origins, as such:
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Content-Type</AllowedHeader>
<AllowedHeader>x-amz-acl</AllowedHeader>
<AllowedHeader>origin</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Now, when I try to perform the file upload, the script returns with XHR Error and my browser's error console gives me a standard CORS error, saying that my Origin is now allowed for that XHR request. I've tried everything I can think of. I've chaned the * wildcard to the actual domain the request originates from to allowing the * wildcard to allowed headers. Nothing seems to work. It continues to produce that CORS error.
Can anyone help me get this off the ground and successfully complete a direct browser upload to S3? I don't care by which means, I just need to be able to get it done. Also, bear in mind that I am a novice when it comes to S3, so the more explicit the instructions, the better.
Thanks!
Try adding a wildcard for the AllowedHeader and allow all methods, like so:
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Great starting points for a direct upload to Amazon S3 are:
For the js:
http://www.designedbyaturtle.co.uk/2013/direct-upload-to-s3-with-a-little-help-from-jquery/
For the php:
http://birkoff.net/blog/post-files-directly-to-s3-with-php/
Or if you're looking for a solution that works out of the box, take a look at Plupload
Hope this gets you started!

Php and tomcat configuration

I have to edit some project in php to my work. I also admit that I'm completly noob in php. I try to configure php and tomcat 6.0 but without success. I making everything like in this tutorial:
http://blog.jackneer.com/2008/10/php-5-on-tomcat-6-installation.html
But I got an error:
type Exception report
message Wrapper cannot find servlet class net.php.servlet or a class
it depends on
description The server encountered an internal error that prevented it
from fulfilling this request.
exception javax.servlet.ServletException: Wrapper cannot find servlet
class net.php.servlet or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703)
java.lang.Thread.run(Thread.java:722)
root cause java.lang.ClassNotFoundException: net.php.servlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703)
java.lang.Thread.run(Thread.java:722)
note The full stack trace of the root cause is available in the Apache
Tomcat/6.0.36 logs.
I was searching on google but I don't found anything helpful. Do you know what should I do? I want to do it on tomcat but if I have to, I used different server. But which is the best to working with php? And easy to configure of course :) Thanks in advance for your help.

Soap error when trying to use the API of Magento

I am looking for help with this problem and I hope someone give me that help. The error is the following:
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://example.com/index.php/api/?wsdl' : failed to load external entity "http://example.com/index.php/api/?wsdl" in
/var/www/presentacion/app/code/local/Pengo/Extension/Model/Something.php on line 28
And the code that I'm using to connect to it is something like this:
$this->_soap = new SoapClient(http://example.com/index.php/api/?wsdl);
and there is where it says is the error.
I have been serching in Google, PHP forums, here in StackOverflow and Magento itself but I don't find the solution anywhere.
What I had seen is that the WSDL is never get parsed or loaded as the error says and none of its functions.
I tried connecting like this:
$options['location'] = http://example.com/index.php/api/?wsdl;
$options['uri'] = 'urn:Magento';
$this->_soap = new SoapClient(null, $options);
like this it doesn't dispatch any error like the others but there aren't functions to use, like in the other case it doesnt' load and parse the WSDL.
I am a bit frustrated because I have been developing this like 1 month and now that I am making some tests it shows this message, I had test it when it was really empty and new and it worked fine.
So any help would be appreciated.
Thank you.
Nine times out of ten this error is Magento is telling you it can't load the WSDL file. Magento is telling you this. It's not your local client code that's complaining.
Magento uses the PHP SoapServer object to create its SOAP API. The SoapServer object needs to access the WSDL as well. Try running the following from your server's command line
curl http://example.com/index.php/api/?wsdl
If I'm right, the above will timeout/fail.
Because of some quirks in DNS, it's surprisingly common that a server won't be able to access itself via its domain name. If this is the case, the quickest fix is adding an entry to the server's hosts file. (Talk to your server admin if none of that made sense)
Well after all the things that I test the only one that worked for me, I don't know why but it worked, was doing this in two separate machines. I tried that because I read that somewhere and I just do it and my Magento and Webservice now works perfectly. Whenever I try to do this local it dispatch the same error.
I hope this can help someone in the future and they don't have to knock their head on the wall because of this problem.
Thank you all for your answers and comments.
Alan Storm is right on the Money here!
Make sure that you check your server Hosts File, and that it includes an entry for both domain and www.domain. Espicialy important if you are doing server rewrites.

Categories