how to update kml file in google map api v3? - google-maps-api-3

My KML file had been uploaded into my Google Map account. But how can I update it without upload again. For example, I want to allow user can change one polygon's color in website. Can user use my account to update my KML file and show it dynamic?
Firstly, I try to use Google Maps Data API and log in my account, but it not work.
<form method="post" action="https://www.google.com/accounts/ClientLogin">
<input type="hidden" name="accountType" value="GOOGLE" />
<input type="hidden" name="Email" value="**#gmail.com" />
<input type="hidden" name="Passwd" value="***" />
<input type="hidden" name="service" value="local" />
<input type="hidden" name="source" value="mycompany-myapp-1" />
<input type="submit" name="submit" value="Submit" />
</form>
Then I get auth="DQ**", and use this auth to do next step:
<form method="get" action="http://maps.google.com/maps/feeds/maps/default/full">
<input type="hidden" name="Authorization" value="GoogleLogin" />
<input type="hidden" name="auth" value="DQ***"/>
<input type="submit" name="submit" value="submit" />
Will get error......
In fact, I just want to make a webpage that allow users to make their own shade maps. I have a KML file of combining many polygons. And these polygon have different style. How can users update polygons' style?
Thanks a lot,

Other users can't change your Google Map account data.
One option would be to import that kml into a FusionTable, then use dynamic styling to change its color. If you want them to be able to change the color and save that change, you could write code to change styling information in the FusionTable, but everyone would see the change, not clear if that is what you want or not.

Related

Wordpress search form by category not working?

Objective
I am trying to create different search forms for two different landing pages. Thus, users who end up on landing page A will only be able to search for products with categories Man and Book. Users landing on page B will only be able to search for products with categories Beast and Funny.
Here is my example setup in WooCommerce.
What I have tried
Based on this link, I have tried the following search function for page A.
<form role="search" method="get" id="searchform" action="https://test.com/">
<div>
<label for="s">Search for (Man and Book):</label>
<input type="text" value="" name="s" id="s" />
<input type="hidden" value="1" name="sentence" />
<input type="hidden" value="product" name="post_type" />
<input type="hidden" value="product_cat" name="man,book" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
Problem
If I key in GetAllX into the search form, I expect to see GetAllX (Copy 2) only. Instead, I see GetAllX (Copy 2) and GetAllX.
Also, when I key in test, I expect to see Test product 2 only. Instead, I see both Test product 2 and Test Product.
Questions
Why is WordPress behaving like this? Can someone help me out with this, please?
If there is an easier way to create search forms for different product categories based on landing pages, please do let me know.
Found the error. It was in this line:
<input type="hidden" value="product_cat" name="man,book" />
It should be instead:
<input type="hidden" value="man,book" name="product_cat" />
There was a typo in the article I linked to.

Logging in and scraping a site like ft.com with BeautifulSoup

I have this url: https://www.ft.com/content/87d644fc-73a4-11e7-aca6-c6bd07df1a3c
It corresponds to an article that requires signing up. I signed up and can see the content in my browser. However when I use this code with the url above:
soup = BeautifulSoup(urllib2.urlopen(url), 'lxml')
with open('ctp_output.txt', 'w') as f:
for tag in soup.find_all('p'):
f.write(tag.text.encode('utf-8') + '\n')
Especially, it redirects me on the signup page. Is there any way to be logged in to have access to the article when scraping?
Here are the basics.
Go to the login page. If you use the Chrome browser you can position your mouse over the email input area and use the context menu (in Windows) and then its 'Inspect' entry to reveal the form element that will be used to submit your email address. It looks like this.
<form name="enter-email-form" action="/login/submitEmail" class="js-email-lookup-form" method="POST" data-test-id="enter-email-form" novalidate="true">
<input type="hidden" name="location" value="https://www.ft.com/content/87d644fc-73a4-11e7-aca6-c6bd07df1a3c">
<input type="hidden" name="continueUrl" value="">
<input type="hidden" name="readerId" value="">
<input type="hidden" name="loginUrl" value="/login?location=https%3A%2F%2Fwww.ft.com%2Fcontent%2F87d644fc-73a4-11e7-aca6-c6bd07df1a3c">
<div class="lgn-box__title">
<h1 class="lgn-heading--alpha">Sign in</h1>
</div>
<div class="o-forms-group">
<label for="email" class="o-forms-label">Email address</label>
<input type="email" id="email" class="o-forms-text js-email" name="email" maxlength="64" autocomplete="off" autofocus="" required="">
<input type="password" id="password" name="password" style="display:none">
<label for="password">
</label></div>
<div class="o-forms-group">
<button class="o-buttons o-buttons--standout o-buttons--big" type="submit" name="Next">Next</button>
</div>
</form>
You will need to gather the action attribute from the form element and all the name-value pairs from the input statements. You use these in a POST request with the requests library.
You do this once for your email address and once for your password. Then you should be able to issue the GET for the URL with requests.
I must warn you that I haven't actually tried this with that particular site.
If you are to scrape a website using BeautifulSoup, I'd recommend the MechanicalSoup library. It is a very lightweight layer on top of BeautifulSoup (to parse HTML) and requests (to fetch pages), but it will deal for you with things like filling-in a form properly (i.e. what you need here), following relative links, ...
MechanicalSoup is also limited in the sense that it doesn't interpret JavaScript code, hence won't work on a website relying on JavaScript, but it reduces the manual effort compared to using BeautifulSoup and urllib or requests directly.
(Note: I'm one of the authors of MechanicalSoup)

POST request to Paypal ignoring parameters

Good afternoon,
I'm attempting to send a POST request from my ASP.NET web app to the paypal API to process a payment. The code below is the standard generated button code from the developer site with a few more parameters added by me.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="business" value="testseller#mydomain.co.uk" />
<input type="hidden" name="hosted_button_id" value="myvalue"/>
<input type="hidden" name="item_name" value="<%:Article%>"/>
<input type="hidden" name="amount" value="<%Price%>"/>
<input type="hidden" name="currency_code" value="GBP"/>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
</form>
However when the paypal payment screen loads, it has reverted the cost to 0.01 US dollars and seemed to ignore my parameters. On inspection, the <%:Price%> variable is reading as I would expect. Is there anything glaring I'm doing wrong in the above HTML?
If you are using Hosted Button which is saved on PayPal side, you cannot edit the button code. PayPal will ignore any additional variable added / update to the button code. If you want to pass dynamic variables to PayPal end, then you should use non hosted button.

Integrating a custom built form with a subscriber list provider (Aweber)

I have created my own form because every other form out there for WordPress is horrible.
div class="exc-form">
<form action="action_page.php">
<fieldset>
<div id="form_jgrsh">
First name:<br>
<input type="text" name="firstname" placeholder="Please enter first name">
<br>
Last name:<br>
<input type="text" name="lastname" placeholder="Please enter last name">
<br>
Email:<br>
<input type="text" name="email" placeholder="Please enter email">
<div class="chk_bx">
<input type="checkbox" name="concent" value="agree">By entering my information and pressing submit I agree to subscribing to the Stockhouse AND Junior Gold Report (please check box before submiting)
<br>
</div>
<input type="submit" class="submit-btn" value="Submit">
</div>
</fieldset>
</form>
It's super simple and isn't anything special. I'm under the impression PHP will be needed as well.
I use Aweber as my list provider, and I've contacted them for support and they want me to use their horrible, ugly form builder, and won't help me integrate my own form to use their list.
I've never done something like this before, so I'm looking for some guidance on how to send subscriber information to a list. Aweber offer's a list ID and most plugins I've seen require a Aweber authentication before Aweber links up to the list.
https://labs.aweber.com/snippets/lists - this is as closest to the resources I could find from Aweber.
Here is the authentication list: https://labs.aweber.com/snippets/authentication

Really Weird ASP.Net Reserved Request.Form key name

I seem to have stumbled across a really weird issue when posting a static HTML page to an ASP.NET page:
Example:
<form action="Kiosk.aspx" method="post">
<input type="hidden" id="key" name="key" value="1234" />
<input type="hidden" id="action" name="action" value="download" />
<input id="btnGo" type="submit" value="Download" />
</form>
When I call it using
string strKioskKey = incomingWebContext.Request.Form["key"];
it always returns null - if I change both the parameters to "key1" it works sweet...
But the question is WHY? I have never heard of a reserved word for requests.
I cannot reproduce this. Your problem lies elsewhere.
You may wish to try and re-create the problem as a small standalone app, and see at what point you can reproduce it (run it locally, then on your dev/live environment).

Resources