Basic concepts of HTTP permission authenticationHttps://en.wikipedia.org/wiki/Basic_access_authenticationAdd Authentication Header informationvar encoder:base64encoder = new Base64encoder () Encoder.encode (username + ': ' + password); var req:urlrequest = new urlrequ EST (); Req.requestHeaders.push (New Urlrequestheader ("Authorization", "Basic" + encoder.tostring ()));Using URLRequest in Flash only supports the annoying place of submitting custom he
In. NET we know that there is a thing called webhttprequest, with which we can achieve a variety of network snooping, monitoring, acquisition and robotics, if an additional
A pattern recognition, that's really hanging up ...
In as we can also achieve the same function, and we can cooperate with JS to do cross-domain, collect cookies and so some user behavior analysis, is also a web development
A sharp weapon.
One: Building communication with external programs
1: Generally take three ste
Fannic original (reproduced please indicate the source of http://ylucy.cnblogs.com)
Use instance of URLRequest
// Set URL Nsurl * URL = [Nsurl urlwithstring: @" Http://www.stackoverflow.com " ];// Set the request// The constructed nsurlrequest hasA specific policy that depends on the cache response. cachepolicy gets the policy and timeoutinterval gets the timeout value.Nsurlrequest * Request = [Nsurlrequest requestwithurl: URLCachep
Request| Server | interactive
Using URLRequest and Urlloader to interact with the server in AS3
The previous version Loadvars method was replaced with Urlloader and URLRequest in AS3. Beginners may be confused again.In the current Help system is not perfect situation (Flash 9 does not help, Flex Builder 2 only in English), here to write a simple tutorial to facilitate the transition to AS3.
In AS3, there ar
Ext.: http://liyanjie918.blog.163.com/blog/static/2022729020128261252258/
Use urlrequest often need to pass parameters, if the parameters include Chinese to the background often garbled, solution one: The parameters are encoded, decoding in the background can be, instance code: Flex side:var urlrequest:urlrequest; var url:string = "******"; var url:string = encodeURI (FullPath); URLRequest = new
URLRequest
The content is also decoded (decoding) if the ContentType is Application/json and the result automatically (automatically) passed T Hrough json.loads.
Examples of official documents:defGot_weather (req, results): forKey, Valueinchresults['Weather'][0].items ():Print(Key,': ', value)Req=URLRequest ('HTTP://API.OPENWEATHERMAP.ORG/DATA/2.5/WEATHER?Q=PARIS,FR', got_weather)Where
In. NET we know that there is a thing called webhttprequest, with which we can achieve a variety of network peeping, monitoring, acquisition and robotics, if the addition of a pattern recognition, it is really hanging ...
In as we can also achieve the same function, and we can cooperate with JS to do cross-domain, collect cookies and so on some user behavior analysis, is also a web development in a sharp weapon.
One: Building communication with external programs
1: Generally take three steps
In. net, we know that there is something called WebHttpRequest, which we can use to implement various network spying, monitoring, collection, and robotics. If a pattern recognition is added, that's a big bang... In as, we can also implement the same
We know that some websites are authenticated by the Basic Authentication of Copper Drum even HTTP. For example, api.fanhou.com
During Air beta2, an air client for food was collected and can run normally. However, after I upgraded to beta3 yesterday,
When doing localization, in order to cooperate with the content Localization on the server side, you need to obtain the current language environment from the client and tell the server side. We set the accept-language attribute in the Request Header
two parts, which are unified into the URLRequest object. Simple url addresses are represented by URLRequest. url, and variables are represented by URLRequest. data. It is much easier to modify.Note that the url address can also be written when the URLRequest constructor is used.2: Data transmission method, post or get
$ _ POST []; how can I define a message in flash and hand it over to post, and then write $ _ POST ['message'] in phph? I want to interact with actionscript in this way, however, php compilation fails. the error message is not defined.
Reply to discussion (solution)
Then you can see what has been passed in.
Paste your code
Then you can see what has been passed in.
Moderator
Have you ever touched on actionscript? this is the actionscript code I found online. I cannot underst
Flash 3 communicates with PHP. Currently, flash is widely used in various aspects. flash not only focuses on its own brilliant results, but also needs to exchange data with external programs to achieve more powerful functions, with the arrival of as3, The flash and external interaction methods become more and more convenient and rational. Today, I will talk about the interaction between as3 and backend data (here I select the as3 php architecture, and other configurations are the same ).
In as
AS3 Open the link and open a new pagefunction _geturl (event:mouseevent): void {var _newurl:http://www.111cn.net/flash_a/action/urlrequest=new http://www.111cn.net/flash_a/Action/urlrequest (".. /index.php tutorial ");var _fangshi:string= "_blank";Navigatetourl (_newurl,_fangshi);}My_btn.addeventlistener (Mouseevent.click,_geturl);
For more information about opening URL instances
Import Flash.net.http://w
First, geturl is as2 and earlier practices. as3 is like this.
Use URL of as3
Import Flash.net. navigatetoURL;
Import Flash.net. URLRequest;
//
Usage
VaR TargetUrl: URLRequest = new URLRequest ("lingo: moviedo (\" withlingo \")");
NavigatetoURL (TargetUrl );
Flash uses geturl to interact with ctor script in three ways: lingo statement, directl
At present, flash in all aspects of the application of more and more wide, and flash is not only focus on their own brilliant effect, but also need to exchange data with external programs to achieve more powerful functions, with the advent of AS3, Flash and external interaction of the way is increasingly simple and rationalized. Talk about the interaction of AS3 and background data here today (choose AS3 PHP Architecture, other configurations in the same vein).
In AS3, the original Loadvars me
. loaderinfo. Parameters attribute is an associated array.
========================================================== ======================================
4. Download an object
As code
VaR filereference: filereference = new filereference ();
VaR URLRequest: URLRequest = new URLRequest ("http://www.myexamplesite.com/example.txt ");
Filereference. Download
used to obtain weather information is a Get synchronous request. Please refer to the following code:
Import UIKitclass ViewController: UIViewController {@ IBAction func showWeatherJson (sender: UIButton) {// create url var url: NSURL! = NSURL (string: "http://www.weather.com.cn/adat/sk/101010100.html") // create the request object var urlRequest: NSURLRequest = NSURLRequest (URL: url, cachePolicy: NSURLRequestCachePolicy. useProtocolCachePolicy, tim
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.