Comments (4)
Understood, thanks. I guess this issue page will always be here, in case anyone else is in the same boat!
from phpsmug.
Wow!! I've not looked at the old code in ages
Your code looks good, but the problem isn't your code, it's with phpSmug - all the API urls are hardcoded to http and these have all been changed on the SmugMug side to redirect to https. Unfortunately, this results in invalid signatures etc and the old version of phpSmug doesn't handle this well.
The fix is to change all the URLs to use https:
diff --git a/phpSmug.php b/phpSmug.php
index 716d22a..d7d95e8 100644
--- a/phpSmug.php
+++ b/phpSmug.php
@@ -369,7 +369,7 @@ class phpSmug {
if ( ( strpos( $command, 'login.with' ) || strpos( $command, 'Token' ) ) || ( $this->oauth_signature_method == 'PLAINTEXT' ) || $this->secure ) {
$endpoint = "https://secure.smugmug.com/services/api/php/{$this->APIVer}/";
} else {
- $endpoint = "http://api.smugmug.com/services/api/php/{$this->APIVer}/";
+ $endpoint = "https://api.smugmug.com/services/api/php/{$this->APIVer}/";
if ( ( isset( $this->SessionID ) && is_null( $this->SessionID ) ) && ( !strpos( $command, 'login.anonymously' ) ) && !$this->OAuthSecret ) {
throw new PhpSmugException( 'Not authenticated. No Session ID or OAuth Token. Please login or provide an OAuth token.' );
}
@@ -655,7 +655,7 @@ class phpSmug {
if ( $this->loginType == 'authd' ) {
$upload_req->setHeader( 'X-Smug-SessionID', $this->SessionID );
} else {
- $upload_req->setHeader( 'Authorization', 'OAuth realm="http://api.smugmug.com/",'
+ $upload_req->setHeader( 'Authorization', 'OAuth realm="https://api.smugmug.com/",'
.'oauth_consumer_key="'.$this->APIKey.'",'
.'oauth_token="'.$this->oauth_token.'",'
.'oauth_signature_method="'.$this->oauth_signature_method.'",'
@@ -678,7 +678,7 @@ class phpSmug {
//$proto = ( $this->oauth_signature_method == 'PLAINTEXT' || $this->secure ) ? 'https' : 'http'; // No secure uploads at this time.
//$upload_req->setURL( $proto . '://upload.smugmug.com/'.$args['FileName'] );
- $upload_req->setURL( 'http://upload.smugmug.com/'.$args['FileName'] );
+ $upload_req->setURL( 'https://upload.smugmug.com/'.$args['FileName'] );
$upload_req->setBody( $data );
//Send Requests
@@ -722,6 +722,7 @@ class phpSmug {
if ( $this->OAuthSecret ) {
$sig = $this->generate_signature( $method, $args );
+
$oauth_params = array (
'oauth_version' => '1.0',
'oauth_nonce' => $this->oauth_nonce,
@@ -825,9 +826,9 @@ class phpSmug {
} else if ( $apicall == 'Upload' ) {
//$proto = ( $this->oauth_signature_method == 'PLAINTEXT' || $this->secure ) ? 'https' : 'http';
//$endpoint = $proto . '://upload.smugmug.com/'.$apiargs['FileName']; // No support for secure uploads yet
- $endpoint = 'http://upload.smugmug.com/'.$apiargs['FileName'];
+ $endpoint = 'https://upload.smugmug.com/'.$apiargs['FileName'];
} else {
- $endpoint = "http://api.smugmug.com/services/api/php/{$this->APIVer}/";
+ $endpoint = "https://api.smugmug.com/services/api/php/{$this->APIVer}/";
}
if ( is_null( $apicall ) ) {
from phpsmug.
Brilliant! Thanks so much for the quick response -- that's got things working.
I've made the changes locally, but do you think it might be worth an official release of 3.5.1?
from phpsmug.
I've made the changes locally, but do you think it might be worth an official release of 3.5.1?
I'm a bit reluctant to as the code is soooo old and ugly I'd really prefer peeps not use it TBH
from phpsmug.
Related Issues (20)
- Trying to access unlisted children of root node with phpSmug HOT 2
- Debugging 400 response HOT 2
- Sorting Albums by Date Added Decending HOT 4
- Undefined offset in Client.php __call() caused by empty URI arguments HOT 3
- Can't upload (from URI & from Local) HOT 2
- $callback url doesn't work! HOT 5
- Problems with expansions HOT 1
- Is this project abandoned? HOT 2
- Feature request: support for _config HOT 1
- Keywords not showing up? HOT 1
- setToken problems using own account credentials HOT 2
- 400 Error code creating album, please help. HOT 4
- list all folders HOT 3
- 404 returned just for our Smugmug site album list HOT 2
- Undefined Property / and Class 'phpSmug\Client' not found HOT 2
- Saving/Reusing the Token HOT 4
- nonce_used error when getting image information HOT 5
- Issue updating keywords HOT 2
- Access headers in response HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpsmug.