Need help creating asynchronous data scraper in WordPress
Need help creating asynchronous data scraper in WordPress
Need help creating asynchronous data scraper in WordPress
How does these functions relate to writing file? Do you want to write to file in general or modify functions to accomplish that? Simple approach – do it with PHP, for example with file_put_contents(). However between different hosting configurations this is not always reliable. Actually workflows in WP make real effort to not write any … Read more
I am retrieving this URL ok on my test stack, which means that either: Remote server was having temporary issues. Your server has configuration or other issues. I would try to install Core Control plugin, force different HTTP transports and see if that helps.
If your AJAX is a ‘post’, or for that matter any protocol, to URL2PNG the client is doing so directly. The client isn’t aware of, nor would it honor you server’s proxy configuration. Considering the brief read of URL2PNG docs, placing your API key and password in your JavaScript/jQuery is risky at best since you’d … Read more
Does your server know its own name and/or have loopback connections allowed? Like, if you do a remote get on just the main blog page, does that work? If the server doesn’t know its own name because the DNS doesn’t resolve, or loopback connections are disabled at the server level (these are common “security” measures … Read more
You would replace this: $dataOrig = file_get_contents(‘http://twitter.com/users/show/’.$twitter_user); if (is_wp_error($dataOrig)) { return ‘Error!!!’; }else{ $profile = new SimpleXMLElement ( $dataOrig ); $countOrig = $profile->followers_count; $count = strval ( $countOrig ); } With this: $dataOrig = wp_remote_get(‘http://twitter.com/users/show/’.$twitter_user); if (is_wp_error($dataOrig)) { return ‘Error!!!’; } else { $profile = new SimpleXMLElement ( $dataOrig[‘body’] ); $countOrig = $profile->followers_count; $count = … Read more
And the strange part: both codes echo the same string for $url!!! No, they don’t. Look at the page source. esc_url() is encoding the & control character. You can’t do that and expect the HTTP request to work correctly. Use esc_url_raw() instead. Note the description in the Codex concerning that function: The esc_url_raw() function is … Read more
Hell yeah it is – check out the HTTP API for more information: $http = wp_remote_get( ‘http://example.com’ ); $data = wp_remote_retrieve_body( $http ); // Carry on coding
So take this code: $bizt_a = json_decode(file_get_contents(“https://karteritesed.hu/biztositok.json”)); Separate it out so that we do 1 thing per line ( if you pass it straight into json_decode what happens if the request fails and that site is down? json_decode isn’t expecting an error message! It’s going to turn around and ask “What’s this?!” ) $json = … Read more
In case anyone has issues like I did, I found this discussion where I added the code and instantly was authenticated. Not sure if its a WordPress issue or a PHP one, but I feel that the ANY portion of the WordPress authentication was getting blocked first to find the Proxy type, but timing out. … Read more