Ucenter communication failure Ultimate Solution

Source: Internet
Author: User
Tags testlink

After the local program is directly uploaded to the official server from my domain name to the official domain name, The ucenter cannot communicate correctly.

Local Domain: http://my74cms.shiyishi.tk

Ucenter: http://myucenter.shiyishi.tk

 

Online Environment Domain Name:

Http://74cms.shiyishi.tk

Http://ucenter.shiyishi.tk

 

All the involved configuration files are correctly configured. Open the Application List in the ucenter and check that the application is still in the "unable to communicate" status.

In short, the ucenter data cache has not been cleared. For example, if appid is 1, the cached URL is my74cms. shiyishi. TK, which is obviously incorrect. Therefore, the cache is cleared, and the communication is successful.

 

Reference: http://wapwenku.baidu.com/view/f6e1c7878762caaedd33d46e? Pn = 2 & vw = All & SSID = & from = & bd_page_type = 1 & uid = ec203f105f15d41dde5676e4339f1231 & Pu = RC @ 1, PIC @ on, SL @ 1, PW @ 1000, SZ @ 224_220, PD @ 1, Fz @ 2, LP @ 2, TPL @ color, & St = 1 & wk = RD & maxpage = 5 & Pos = all

Debugging is essential for program development. There may be a variety of problems, so we need to find a solution.

1. How to debug communication failures is shown in

 

 

Don't be afraid of this. In fact, the problem is far less complicated than you think.

Since debugging is the root of the problem, it is the same as the vine, you should first find the vine

 

Note: This tutorial uses the Firefox browser. I am not giving him ad here. It is a series of debugging tools for Firefox.

 

1. Let's first look at the four words "communication failed?

Do you feel that the communication fails or the communication is successful only after the page is loaded. This is not directly output on the page. Instead, the page re-loads js to judge and then display it.

Let's look at the source code of this page. You can right-click IE to view the source file. Firefox needs to select this frame --> view the source code of the frame.

 

In the source code, find the tag that shows the communication failure. This is not difficult. As shown in

 

 

The communication status is the JS processing result highlighted in the figure. It looks different from a normal JS call. Don't be afraid. Check the JS Code starting with this source code.

1. 2. 3. 4. 5. 6.

<SCRIPT type = "text/JavaScript"> var apps = new array (); var run = 0;

Function testlink () {If (apps [run]) {

$ ('Status _ '+ apps [run]). innerhtml =' connecting ...';

Page 2/5

7. $ ('link _ '+ apps [run]). src = $ ('link _' + apps [run]). getattribute ('testlink') +

'& SID = 433erjfcvi87jtvtwbcz % 2ffxfyppjacxkubbq7jgcgncuujcfcbks0xrgdxua5ziyzrkxcy % 2f2n77ha ';

8. 9.

 

} Run ++;

10 .}

11. Window. onload = testlink; 12. </SCRIPT> copy the code.

See.

2. Since "Teng" has been found, let's start to "Touch" it.

Copy this Code directly through a browser.

 

 

Now we can see that the four failed communications come from this. Haha. But I still don't know why it failed?

Don't worry, you haven't touched it yet. I will continue to touch it without shouting.

Next we need to set several breakpoints in the UC code, which is actually the die after Echo. Let's look at the current URL address.

1. http://uc.860472.com/admin.php? M = app & A = Ping & inajax = 1 & url = http % 3A % 2f % 2fwww.860472.com & IP = & appid = 1 & random = 1377646808

Copy code

M = app indicates that the controller prototype is app. Because it is the background access, it corresponds to./control/admin/APP. php under the ucenter directory.

A = Ping indicates that the onping method in the Controller prototype is executed.

Note: If you want to answer the question, you can go to the admin. PHP Portal.

Page 3/5

 

Okay. Let's take a small step forward. Open the./control/admin/APP. php file and find the onping method. The source code is as follows:

1. 2. 3. 4. 5. 6. 7.

Function onping (){

$ IP = getgpc ('IP'); $ url = getgpc ('url ');

$ Appid = intval (getgpc ('appid '));

$ App =$ _ env ['app']-> get_app_by_appid ($ appid); $ status = '';

If ($ app ['extra '] ['apppath'] & @ include $ app ['extra'] ['apppath']. '. /API /'. $ app ['apifilename']) {

8. 9.

$ Uc_note = new uc_note ();

$ Status = $ uc_note-> test ($ note ['getdata'], $ note ['postdata']);

10.} else {

11. $ this-> load ('note ');

12. $ url = $ _ env ['note']-> get_url_code ('test', '', $ appid); 13. $ status = $ _ env ['app']-> test_api ($ URL, $ IP); 14 .}

15. If ($ status = '1') {16. Echo

'Document. getelementbyid (\ 'status _'. $ appid. '\'). innerhtml = " <SPAN class = \ 'green \'> '. $ this-> Lang ['app _ connent_ OK ']. '</span> "; testlink ();'; 17 .} else {18. echo

'Document. getelementbyid (\ 'status _'. $ appid. '\'). innerhtml = " <Span

Class = \ 'Red \ '> '. $ this-> Lang ['app _ connent_false ']. '</span> "; testlink ();'; 19 .} 20.

Page 4/5

21.} copy the code

I will not explain this code one by one. With snacks, you can see it carefully.

We can see that when the $ status is equal to 1, the output communication is successful, and the output communication fails. Well, let's output this $ status directly to see what it is when it is not equal to 1. In

1. if ($ status = '1 '){

Copy code

Add a line of code

1. Echo "\ $ url = $ URL <br/> \ n \ $ status = $ status <br/> \ n"; die ('hahahaha ');

Copy code

Okay, the breakpoint is set. Save the code and refresh the page.

3. Finally, I was almost touched on the "Melon". I was a little excited. It was not difficult to debug it.

Refresh the page and you will see something like this

 

 

 

Oh. It turns out that the access address of my application is incorrect.

4. Find out what you want. Is it easy to prescribe the right medicine next.

Remember to remove the debugging code.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.