user2145246
user2145246

Reputation: 11

Pinterest button - invalid url

Since yesterday when Pinterest updated its website, my Pinterest 'Pin it' buttons stopped functioning properly, i.e. the spinning wheel goes forever in the popup window.

My code - which used to work fine - is:

    <a data-pin-config="beside" href="//pinterest.com/pin/create/button/?url=<?=urlencode($url)?>&media=<?=urlencode($image_url) ?>&description=The picture I just pinned!" data-pin-do="buttonPin" >
     <img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />
    </a>                    

I also include the Pinterest js just before the </body> closing tag.

What is interesting is that when I go on Pinterest's website and try to Add Pin by URL, I get:

"Whoops! Invalid URL"

My $url refers to php pages which pass several parameters, i.e. http://www.mywebsite.com/img.php?img_id=photo (999).jpg&album=...&page=...

Update #1: I noticed that when the posted URL does not contain any parentheses, there is no problem posting on Pinterest directly or via the buttons. Although the URLs are all urlencoded in php, i.e. the ( and ) are encoded to %28 and %29 respectively, which should be taking care of the parentheses, it does not seem to work. The browser still shows the parentheses although I realize that it is interpreting the url encoded %28 and %29 codes.

Update #2: Received reply from Pinterest saying

"Sometimes we see this behavior if a website is blocking Amazon IPs. Make sure you're not blocking Amazon IPs or whitelist our user agent:

Pinterest/0.1 +http://pinterest.com/

Unfortunately, we don't have a dedicated group of IPs that you could whitelist because our IPs change over time."

Following Pinterest's reply, I did my research and came up with the following relevant links:

Questions:

Upvotes: 1

Views: 12223

Answers (1)

user2145246
user2145246

Reputation: 11

Problem solved!

It was not the parentheses that were causing the failure to pin (or share on Tumblr), but the spaces in the URL (in my case the space before the parenthesis). Although the spaces were URL encoded (+), Pinterest was viewing it as an invalid URL.

I removed all spaces from the picture file names, which means also from the URL since the URL passes as a parameter the picture filename.

This fixed the issues for both the Pinterest and Tumblr buttons.

Upvotes: 1

Related Questions