Pergunta

I was trying to implement a way to track pinit button as described here

here is my code:

var fbUrl = RootLink;
var trackUrl = "//pinterest.com/pin/create/button/?url=" + RootLink + "&media=" + 
    RootLink + "trackPinit.php?userId=" + userId + "%26itemId=" + 
    items[cnt].item_id + 
    "%26image="+encodeURIComponent(items[cnt].item_img) +
    "&description=Next%20stop%3A%20Pinterest";

trackUrl = encodeURIComponent(trackUrl);

var url = "<a href='JavaScript:newPopup(\"" + trackUrl + "\",\"" +
    items[cnt].item_id + 
    "\");'><img src='//assets.pinterest.com/images/pidgets/pin_it_button.png'/></a>"

jQuery( "#i-cell-" + cnt_rows + "-" + 
    cnt_cells).append($("<div>").append($(url))
);

and php page:

$userAgent = isset($_SERVER['HTTP_USER_AGENT']) 
    ? $_SERVER['HTTP_USER_AGENT'] 
    : '';\
if ( preg_match('/^Pinterest/d+.d+.*$/', $userAgent) ) {
    echo "ccccc";
}
header('Location: ' . $_GET['image'] . "&size=" . $_GET['size'] . 
    "&tid=".$_GET['tid'] , true, 301
);

image is uploaded when window popup, but when i click the button pinit, I am getting the error "Sorry we could not fetch the image."

could you please help to figure out what is the problem.

Foi útil?

Solução 2

I discover that I am using the local Domain, which is not accessible by pinterest, I uploaded all files to online server with real domain and problem solved

Outras dicas

Mohammed,

The Pinterest web service tries to access the image you send in the 'media' parameter in order to display the image in the Pinterest popup.

If the Pinterest service cannot locate the image at the specified path (http status 404), or does not have access to the image (for example status 403 - forbidden), you will see the error you mention above.

I suggest you ensure the image is located at a URL that will respond with http status 200 - success.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top