@@ -194,12 +194,20 @@ public function getTableData($tableName)
194
194
case 'EXTERNAL_LINKS ' :
195
195
case 'SOCIAL_ACTIVITY ' :
196
196
case 'LATEST_BACKLINKS ' :
197
- $ data = $ this ->downloadCSV_XTRA (
198
- $ this ->getWebsite (),
199
- $ tableName ,
200
- $ this ->getDateStart (),
201
- $ this ->getDateEnd ()
197
+ $ options = $ this ->getTableOptions ($ tableName );
198
+
199
+ $ url = sprintf (
200
+ self ::SERVICEURI . $ options ['token_uri ' ] . '?hl=%s&siteUrl=%s ' ,
201
+ $ this ->getLanguage (), $ this ->getWebsite ()
202
+ );
203
+ $ token = $ this ->getToken ($ url , $ options ['token_delimiter ' ], $ options ['dl_uri ' ]);
204
+
205
+ $ url = sprintf (
206
+ self ::SERVICEURI . $ options ['dl_uri ' ] . '?hl=%s&siteUrl=%s&security_token=%s&prop=ALL&db=%s&de=%s&more=true ' ,
207
+ $ this ->getLanguage (), $ this ->getWebsite (), $ token , $ this ->getDateStart ()->format ('Ymd ' ), $ this ->getDateEnd ()->format ('Ymd ' )
202
208
);
209
+
210
+ $ data = $ this ->getData ($ url );
203
211
break ;
204
212
default : // TOP_QUERIES || TOP_PAGES
205
213
$ downloadUrls = $ this ->getDownloadUrls ($ this ->getWebsite ());
@@ -534,31 +542,6 @@ protected function getDownloadUrls($site)
534
542
return json_decode ($ downloadList , true );
535
543
}
536
544
537
- /**
538
- * Downloads "unofficial" downloads based on the given URL.
539
- *
540
- * @param string $site Site URL available in GWT Account.
541
- * @param string $tableName Table name to be downloaded
542
- * @return mixed downloaded data
543
- */
544
- private function downloadCSV_XTRA ($ site , $ tableName , DateTime $ dateStart , DateTime $ dateEnd )
545
- {
546
- $ options = $ this ->getTableOptions ($ tableName );
547
-
548
- $ uri = sprintf (
549
- self ::SERVICEURI . $ options ['token_uri ' ] . '?hl=%s&siteUrl=%s ' ,
550
- $ this ->getLanguage (), $ site
551
- );
552
- $ token = $ this ->getToken ($ uri , $ options ['token_delimiter ' ], $ options ['dl_uri ' ]);
553
-
554
- $ url = sprintf (
555
- self ::SERVICEURI . $ options ['dl_uri ' ] . '?hl=%s&siteUrl=%s&security_token=%s&prop=ALL&db=%s&de=%s&more=true ' ,
556
- $ this ->getLanguage (), $ site , $ token , $ dateStart ->format ('Ymd ' ), $ dateEnd ->format ('Ymd ' )
557
- );
558
-
559
- return $ this ->getData ($ url );
560
- }
561
-
562
545
/**
563
546
* Regular Expression to find the Security Token for a download file.
564
547
*
0 commit comments