[Advice] self-taught connection with the Sina Weibo open platform, running the SDK provided by Sina reports an error

Source: Internet
Author: User
Tags oauth scream
[Advice] self-taught connection with the Sina Weibo open platform, running the SDK error environment provided by Sina: Win7 (x64), Wamp integration (PHP5.4.3 + MySQL5.5.24 + Apache2.4.2 + PHPMyAdmin3.5.1)
Sina php sdk version: the oldest (weibo-oauth-class-with-image-avatar-06-29-update)
Objective: to learn how to create a simple microblog and link it to the Sina Weibo open platform
Question: add some" "WB_AKEY" "WB_SKEY" has been applied, and the "WB_CALLBACK_URL" path has been changed.
----------------------------------- Error message ------------------------------------------
(! ) SCREAM: Error suppression ignored
(! ) Fatal error: Call to undefined function curl_init () in C: \ wamp \ www \ PHP100 \ PHP100-sina \ weibooauth. php on line 1687
Call Stack
# Time Memory Function Location
1 0.0008 250576 {main} () .. \ index. php: 0
2 0.0060 610864 WeiboOAuth-> getRequestToken () .. \ index. php: 8
3 0.0060 611320 WeiboOAuth-> oAuthRequest () .. \ weibooauth. php: 1575
4 0.0070 615504 WeiboOAuth-> http () .. \ weibooauth. php: 1674

----------------------------- Partial index. php code ------------------------------------
Session_start ();
// If (isset ($ _ SESSION ['last _ key']) header ("Location: weibolist. php ");
Include_once ('config. php ');
Include_once ('weibooauth. php ');
$ O = new WeiboOAuth (WB_AKEY, WB_SKEY );
$ Keys = $ o-> getRequestToken (); error line
If (strpos ("http: // localhost/PHP100/PHP100-sina/", 'index. php') = false)
$ Callback = 'http: // localhost/PHP100/PHP100-sina/callback. php ';
Else
$ Callback = str_replace ('index. php', 'callback. php', $ _ SERVER ['script _ URI ']);
---------------------------- Weibooauth. php code --------------------------------------
Function getRequestToken ($ oauth_callback = NULL ){
$ Parameters = array ();
If (! Empty ($ oauth_callback )){
$ Parameters ['auth _ callback'] = $ oauth_callback;
}
$ Request = $ this-> oAuthRequest ($ this-> requestTokenURL (), 'get', $ parameters); an error is returned.
$ Token = OAuthUtil: parse_parameters ($ request );
$ This-> token = new OAuthConsumer ($ token ['oauth _ token'], $ token ['oauth _ token_secret ']);
Return $ token;
}

========================================================== ========================================================== ====================
Function oAuthRequest ($ url, $ method, $ parameters, $ multi = false ){

If (strrpos ($ url, 'http ://')! = 0 & strrpos ($ url, 'http ://')! = 0 ){
$ Url = "{$ this-> host} {$ url}. {$ this-> format }";
}
// Echo $ url;
$ Request = OAuthRequest: from_consumer_and_token ($ this-> consumer, $ this-> token, $ method, $ url, $ parameters );
$ Request-> sign_request ($ this-> shaw.method, $ this-> consumer, $ this-> token );
Switch ($ method ){
Case 'get ':
// Echo $ request-> to_url ();
Return $ this-> http ($ request-> to_url (), 'Get'); error line
Default:
Return $ this-> http ($ request-> get_normalized_http_url (), $ method, $ request-> to_postdata ($ multi), $ multi );
}
}


Reply to discussion (solution)

Fatal error: Call to undefined function curl_init ()...
You have not loaded the php_curl extension

Fatal error: Call to undefined function curl_init ()...
You have not loaded the php_curl extension


Include?

Php. ini
Extension = php_curl.dll

Commented out by default
; Extension = php_curl.dll

Note that the libeay32.dll and ssleay32.dll libraries are required for this extension.

Php. ini
Extension = php_curl.dll

Commented out by default
; Extension = php_curl.dll

Note that the libeay32.dll and ssleay32.dll libraries are required for this extension.


Extension = php_curl.dll removed;
How can I view libeay32.dll and ssleay32.dll?

In the php installation directory
You can use it. if loading errors occur, you need to handle them.

In the php installation directory
You can use it. if loading errors occur, you need to handle them.


Libeay32.dll and ssleay32.dll
Under the php Directory

That's not enough?
Restart apache and test your code.

That's not enough?
Restart apache and test your code.


Restart. the dll file system32 is available in the php folder.
(! ) SCREAM: Error suppression ignored
(! ) Fatal error: Call to undefined function curl_init () in C: \ wamp \ www \ PHP100 \ PHP100-sina \ weibooauth. php on line 1687
Call Stack
# Time Memory Function Location
1 0.0005 251568 {main} () .. \ index. php: 0
2 0.0062 611880 WeiboOAuth-> getRequestToken () .. \ index. php: 8
3 0.0062 612336 WeiboOAuth-> oAuthRequest () .. \ weibooauth. php: 1575
4 0.0069 616528 WeiboOAuth-> http () .. \ weibooauth. php: 1674
Is it because I use the oldest version of the php sdk?
I have another php sdk of the latest version, but I am prompted that an error occurred while accessing it!
Your website fails to be authenticated on Sina Weibo. please contact the author or try again later.
(Error: redirect_uri_mismatch)
Do you have to wait for authentication? Can be tested locally. I also set the callback page address in OAuth2.0 authorization settings.

That's not enough?
Restart apache and test your code.


Thank you!
My own problem, config. The php callback address is set to http ://.........
Brain enters the water
-------------------------------------------------------------------
The authorization page is in. everything is normal.
However
(! ) SCREAM: Error suppression ignored
(! ) Notice: Undefined index: keys in C: \ wamp \ www \ PHP100 \ PHP100-sina \ callback. php on line 9
Call Stack
# Time Memory Function Location
1 0.0003 250944 {main} () .. \ callback. php: 0

(! ) SCREAM: Error suppression ignored
(! ) Notice: Undefined index: keys in C: \ wamp \ www \ PHP100 \ PHP100-sina \ callback. php on line 9
Call Stack
# Time Memory Function Location
1 0.0003 250944 {main} () .. \ callback. php: 0

(! ) SCREAM: Error suppression ignored
(! ) Notice: Undefined index: oauth_verifier in C: \ wamp \ www \ PHP100 \ PHP100-sina \ callback. php on line 11
Call Stack
# Time Memory Function Location
1 0.0003 250944 {main} () .. \ callback. php: 0

(! ) SCREAM: Error suppression ignored
(! ) Fatal error: Call to undefined function curl_init () in C: \ wamp \ www \ PHP100 \ PHP100-sina \ weibooauth. php on line 1687
Call Stack
# Time Memory Function Location
1 0.0003 250944 {main} () .. \ callback. php: 0
2 0.0040 611360 WeiboOAuth-> getAccessToken () .. \ callback. php: 11
3 0.0040 611816 WeiboOAuth-> oAuthRequest () .. \ weibooauth. php: 1611
4 0.0047 616016 WeiboOAuth-> http () .. \ weibooauth. php: 1674
Is it swollen again ????

Reference the reply from xuzuning on the 7th floor: Is that okay?
Restart apache and test your code.
Thank you!
My own problem, config. The php callback address is set to http ://.........
Brain enters the water
-------------------------------------------------------------------
The authorization page is in. everything is normal ......


Config. php
Session_start ();

Include_once ('config. php ');
Include_once ('saetv2. ex. class. php ');
$ O = new SaeTOAuthV2 (WB_AKEY, WB_SKEY );
If (isset ($ _ REQUEST ['code']) {
$ Keys = array ();
$ Keys ['code'] = $ _ REQUEST ['code'];
$ Keys ['redirect _ uri '] = WB_CALLBACK_URL;
Try {
$ Token = $ o-> getAccessToken ('code', $ keys );
} Catch (OAuthException $ e ){
}
}
--------------------------------
Should I replace WB_AKEY, WB_SKEY, and WB_CALLBACK_URL?

Isn't there a Fatal error: Call to undefined function curl_init () in?
Your curl is not loaded successfully!

Copy libeay32.dll and ssleay32.dll to system32
Because your operating system is 64-bit, you may need to set these two files to run in 32-bit compatibility mode.

Isn't there a Fatal error: Call to undefined function curl_init () in?
Your curl is not loaded successfully!

Copy libeay32.dll and ssleay32.dll to system32
Because your operating system is 64-bit, you may need to set these two files to run in 32-bit compatibility mode.


Fatal error: Call to undefined function curl_init () problem solved
The current error is:
(! ) Notice: Undefined index: keys in C: \ wamp \ www \ PHP100 \ PHP100-sina \ callback. php on line 9
Call Stack
# Time Memory Function Location
1 0.0004 250992 {main} () .. \ callback. php: 0

(! ) Notice: Undefined index: keys in C: \ wamp \ www \ PHP100 \ PHP100-sina \ callback. php on line 9
Call Stack
# Time Memory Function Location
1 0.0004 250992 {main} () .. \ callback. php: 0

(! ) Notice: Undefined index: oauth_verifier in C: \ wamp \ www \ PHP100 \ PHP100-sina \ callback. php on line 11
Call Stack
# Time Memory Function Location
1 0.0004 250992 {main} () .. \ callback. php: 0

(! ) Notice: Undefined index: oauth_token in C: \ wamp \ www \ PHP100 \ PHP100-sina \ weibooauth. php on line 1613
Call Stack
# Time Memory Function Location
1 0.0004 250992 {main} () .. \ callback. php: 0
2 0.0050 607424 WeiboOAuth-> getAccessToken () .. \ callback. php: 11

(! ) Notice: Undefined index: oauth_token_secret in C: \ wamp \ www \ PHP100 \ PHP100-sina \ weibooauth. php on line 1613
Call Stack
# Time Memory Function Location
1 0.0004 250992 {main} () .. \ callback. php: 0
2 0.0050 607424 WeiboOAuth-> getAccessToken () .. \ callback. php: 11
???????, ???????? ??? Parameters ????
Blue is a link, and the following code will appear at one point:
----------------------------------------------------------------------------------

(! ) Notice: Undefined index: oauth_token in C: \ wamp \ www \ PHP100 \ PHP100-sina \ weibolist. php on line 8
Call Stack
# Time Memory Function Location
1 0.0009 257280 {main} () .. \ weibolist. php: 0

(! ) Notice: Undefined index: oauth_token_secret in C: \ wamp \ www \ PHP100 \ PHP100-sina \ weibolist. php on line 8
Call Stack
# Time Memory Function Location
1 0.0009 257280 {main} () .. \ weibolist. php: 0

(! ) Notice: Undefined index: name in C: \ wamp \ www \ PHP100 \ PHP100-sina \ weibolist. php on line 14
Call Stack
# Time Memory Function Location
1 0.0009 257280 {main} () .. \ weibolist. php: 0
????~ ?????? Why?

Input box, probably Sina DEMO
?????????

Input box, probably Sina DEMO
?????????

Input box, probably Sina DEMO

(! ) Warning: Illegal string offset 'text' in C: \ wamp \ www \ php100\ PHP100-sina \ weibolist. php on line 52
Call Stack
# Time Memory Function Location
1 0.0009 257280 {main} () .. \ weibolist. php: 0
/

(! ) Warning: Illegal string offset 'text' in C: \ wamp \ www \ php100\ PHP100-sina \ weibolist. php on line 52
Call Stack
# Time Memory Function Location
1 0.0009 257280 {main} () .. \ weibolist. php: 0
4

(! ) Warning: Illegal string offset 'text' in C: \ wamp \ www \ php100\ PHP100-sina \ weibolist. php on line 52
Call Stack
# Time Memory Function Location
1 0.0009 257280 {main} () .. \ weibolist. php: 0
4

Same question ..................

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.