• Resolved comziz

    (@comziz)


    Hello I’m trying to import json from url (https://www.btcturk.com/api/ticker) but I get the data invalid error.

    I validated the json format from another website, but i can not seem to import it.

    I would really like to import the data from there;

    {“high”:1565.01,”last”:1536.90,”timestamp”:1388632896.0,”bid”:1540.0,”volume”:50.76,”low”:1534.00,”ask”:1552.00}

    like this;
    column1 column2
    High….value
    last….value
    time….date
    bid…..value
    low…..value

    isn’t there anyway to accomplish this with this beautiful plugin?

    https://www.ads-software.com/plugins/tablepress/

Viewing 10 replies - 16 through 25 (of 25 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Always glad when I can help!
    If there’s anything for this where I might be able to assist, just let me know!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Got my debug logging working again…

    I am getting an error. Here is the area of code I am looking at:

    case 'url':
    				if ( ! empty( $import['url'] ) && 'https://' != $import['url'] ) {
    					$import_data['file_location'] = download_url( $import['url'] ); // download URL to local file
    					$import_data['file_name'] = $import['url'];
    					write_log($import);
    					write_log($import_data);
    					if ( ! is_wp_error( $import_data['file_location'] ) ) {
    						$import_error = false;
    					}
    					$unlink_file = true;
    				}
    				break;

    $import_data contains:

    [21-May-2014 18:24:41 UTC] Array
    (
        [file_location] => WP_Error Object
            (
                [errors] => Array
                    (
                        [http_request_failed] => Array
                            (
                                [0] => A valid URL was not provided.
                            )
    
                    )
    
                [error_data] => Array
                    (
                    )
    
            )
    
        [file_name] => https://localhost:8090/leaderboard/1
    )

    Hope this gives some insight.

    To answer your earlier question, by “grouping” I am referring to grouping the data. Consider the following data:

    Game    Player    Score
    G1      Jim       10
    G1      John       8
    G2      Jim        2
    G2      John      10
    G3      Jim       10
    G3      John       0

    I would like to group on Player so the grid will display as follows:

    Player    Score
    > Jim       22
    > John      18

    And the ‘>’ will expand detail. Example

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, that logging output indicates, that the server can not access the JSON data. The question is: Is the server where WordPress is running on also on the “localhost”. Remember that a server on the internet can not access your “localhost”, as “localhost” will always be the server itself, i.e. every computer is its own “localhost”.

    For the grouping: Thanks, now I understand. That DataTables example is in fact available as a TablePress Extension. See https://www.ads-software.com/support/topic/group-by-column?replies=4#post-4473284 for details.

    Regards,
    Tobias

    Yes, it’s on my dev box. WordPress site is running inside WAMP on localhost and the IIS service is running on another port on localhost. The service works because I can open the browser and see the JSON. However, I am wondering if going between the 2 ports is the issue with WP? I think that is where I am sitting at the moment. I have aliased the service to eliminate its port, but it still fails. CORS perhaps?

    Thanks! Will look at the extension.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, it’s probably some connection issue then. As a test, can you maybe save a sample file from the IIS service and access it trough WAMP? If that can then be imported from within WordPress, we know that the issue is with the ports/connection.
    Regardless, it’s nothing really that TablePress can do anything about as the actual URL access is done by WordPress (or actually by a PHP library).

    Regards,
    Tobias

    Yes, it is definitely a PHP/WP issue, not TablePress. Thanks for the assistance!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome!
    It might even be just a localhost thing that goes away once you move to “real” server.

    Best wishes,
    Tobias

    I ended up shutting down my IIS site that was running on port 80 and set my new services up on localhost:80. Once I did that WP started getting the data.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    very cool! Great to hear that you could make this work! ??

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Invalid import data – Json – from URL’ is closed to new replies.