I have implemented a image gallery where in each image is differentiated by its record id . the like button works properly for rest of images only for two images its not working as intended , this is the post content sent by the image that is working properly
connect_text 0
edge_type like
fb_dtsg AQC7N-EB
href http://www.mydomain.com/images/p.php?id=2422
iframe_referer http://www.mydomain.com/index.php
is_personalized false
layout button_count
lsd
node_type link
now_connected true
page_id
post_form_id 7500ee8867c2d00acc75d7b6dfe2c733
post_form_id_source AsyncRequest
ref
and the facebook response for this is :
for (;;);{"__ar":1,"payload":{"requires_login":false,"error_info":null,"show_error":false,"node_type":"ExternalLink","node_id":"10150246004339081","edge_type":"ExternalLinkLike","connect_text":0,"success":true,"already_connected":true,"user_profile":{"name":"Mamamia","profile_url":"http:\/\/www.facebook.com\/profile.php?id=100002607508082","pic_square":"http:\/\/profile.ak.fbcdn.net\/static-ak\/rsrc.php\/v1\/yo\/r\/UlIqmHJn-SK.gif"},"story_fbid":107571802673069,"is_admin":false,"admin_url":""},"invalidate_cache":[0]}
while for the faulty image post data is
connect_text 0
edge_type like
fb_dtsg AQC7N-EB
href http://www.mydomain.com/images/p.php?id=2420
iframe_referer http://www.mydomain.com/index.php
is_personalized false
layout button_count
lsd
node_type link
now_connected true
page_id
post_form_id 7500ee8867c2d00acc75d7b6dfe2c733
post_form_id_source AsyncRequest
ref
and its response is
for (;;);{"__ar":1,"payload":{"requires_login":false,"success":false,"already_connected":false,"is_admin":false,"show_error":false,"error_info":null}}
can any body tell me why like buttons are working on some images are not working on others t ? the images content is brought from database and is linked in the page by looping the array in foreach condition so hyperlinks are same except for the id of image,the hyperlink is
http://www.facebook.com/plugins/like.php?href=http://www.mydomain.com/images/p.php?id=<?php echo $array[id]; ?>
thanks in advance
Not a proper answer, so sorry for that. But I'm experiencing the same problem exactly. It looks like facebook simply has a problem with certain GET variables in URLs. I can't think of any other explanation, it works for some and not others. The ones it doesn't work for appear to be random.
I think this must be a facebook bug. The only thing I can think to do is to either submit the bug or sit tight and hope they've spotted the problem and are working on it! Pain in the arse, mind.
EDIT: Well, I've got a workaround. Just add a random GET variable to your URL string. I went with 's=true' and that worked. Weird stuff, it must mistake URLs ending in certain numbers as character entities.
I had the same error in my header. It seems the url (domain) did not
pass the validation by facebook. In my case, i had 2 dots in it.
www.somedomain.net16.net (just a working domain)
To see if facebook can retreive data from your site use this url:
http://developers.facebook.com/tools/debug/
To test it, just type www.google.nl and you get all kind of information back.
Use facebook's iframe suggested code which can be obtained here
http://developers.facebook.com/tools/lint/
Related
I'm uploading the video through my app using the documented PHP API library with pretty much the same code as here; https://developers.google.com/youtube/v3/code_samples/php#updating_a_video_by_adding_new_tags.
The uploaded video receives the title, description and playlist correctly, but not the tags.
Any clues at all?
Edit:
I'm wondering if it has anything to do with scope, does it matter if i've authorized with https://www.googleapis.com/auth/youtube or https://www.googleapis.com/auth/youtube.upload?
This question: Youtube Google API V3: List Videos not returning video tags
gets an answer suggesting the "onBehalfOfContentOwner" parameter, however, i'm getting "HTTP 403: youtube.common, Access forbidden. The request may not be properly authorized" when trying to upload with that parameter ($insertRequest = $youtube->videos->insert('status,snippet', $video, ['onBehalfOfContentOwner' => true]);)
I found the problem, not sure why it is a problem though; when setting the tags i was doing an array filter, when i removed that as a desperate test or "am i blind and using the wrong array_* function", the tags came through
So changing
$snippet->setTags(array_filter($medium['properties']['keywords']));
to
$snippet->setTags($medium['properties']['keywords']);
did the trick... I could reproduce the problem by re-adding the array_filter, and i made sure to check so it wasn't actually empty,
var_dump(array_filter($medium['properties']['keywords']), $medium['properties']['keywords']);
yielded the same result
How do i change a url in a string example :
This is a link http://google.com.au
To something like this
This a warning page link http://google.com.au
EDIT:
What i'm trying to do is take a description entered by the end user, They might enter links in the description, i want to change all the links to make them GOTO a warning page, the warning page is ./warn.php?site=link
The string might look like this
This is a awesome description Google and this another link Google images
Ok here's what i tried:
$descc = mysql_real_escape_string($_POST['description']);
$descc = preg_replace('"\b(http://\S+)"', '$1', $descc);
Check this, although im not sure if you are really refering to this, just let me know the case then ---
$mylink = "http://google.com.au";
This a warning page link http://google.com.au
EDIT version 1.0
Even it is on description box data you can fetch it via jquery or php like
$mylink = $_GET['desc_name_data'];
Please be more specific with the problem :)
EDIT Version 1.1
Check this and let me know then --
echo preg_replace('(<a href="http://\S+)', '<a href="./warn.php?site='.'google.com.au'.'">google.com.au', $descc);
I'm not sure I understand your question, but urlencode may help.
http://google.com.au
If this isn't it, then please be a bit more specific with what you're trying to achieve and what you have tried.
EDIT:
Ok, you could try a HTML parser to extract the href from the link, then rewrite appropriately. This is likely to be more reliable that a regex.
You should still add urlencode if you're passing a url as a querystring.
You could have a look at preg_replace().
Is there a quick way to pull twitter profile image in PHP or Javascript? I need to get the url of the FULL image (not avatar size). Thanks. Any code sample is good.
Twitter has had a nice simple URL.
https://api.twitter.com/1/users/profile_image/abraham
It has size options like "?size=bigger"
You can read more about it on Little known Twitter and TwitterAPI tips and tricks.
Twitter now has documentation up as GET users/profile_image/:screen_name.
Update: Support for this method has been removed from v1.1 of the API. Recommended practice going forward is GET /users/show and cache profile_image_url locally in your service/app.
function get_big_profile_image($username, $size = '') {
$api_call = 'http://twitter.com/users/show/'.$username.'.json';
$results = json_decode(file_get_contents($api_call));
return str_replace('_normal', $size, $results->profile_image_url);
}
get_big_profile_image('bobsaget', '_bigger') should return a large avatar:
http://a1.twimg.com/profile_images/330305510/n229938150541_9850_bigger.jpg
get_big_profile_image('bobsaget') should return an even larger image: http://a1.twimg.com/profile_images/330305510/n229938150541_9850.jpg
Apologies if this is something that's now known, but I didn't see it documented anywhere during my searches, including the official Twitter docs.
You can add the ?size=original as a parameter, which will return the original uploaded image for the user.
So:
http://api.twitter.com/1/users/profile_image/twitter.json?size=original
Previous answerers have provided the correct answer I wanted to link to original twitter api doc page so you'd know it is actually an official way of doing stuff:
You need to specify ?size=
bigger - 73px by 73px
normal - 48px by 48px
mini - 24px by 24px
http://api.twitter.com/1/users/profile_image/twitter.json?size=bigger
http://api.twitter.com/1/users/profile_image/twitter.json?size=normal
http://dev.twitter.com/doc/get/users/profile_image/:screen_name
So, it's not in the docs (http://dev.twitter.com/doc/get/users/profile_image/:screen_name), but it looks like after retrieving the image by specifying any of the three sizes (bigger, normal, mini), you can just remove the suffix before the file extension to get the original image. Hmm... is this safe to use?
For example, this query: api.twitter.com/1/users/profile_image/rrbrambley
Results in: a2.twimg.com/profile_images/931772958/deformed_cropped_headonly_normal.jpg
If I change this url by removing "_normal" then I get the original image: a2.twimg.com/profile_images/931772958/deformed_cropped_headonly.jpg
I know there are apps that use the original image. This must be the way?
When you get original image link, you can modify it to get bigger.
http://pbs.twimg.com/profile_images/34543543/image_name_normal.jpg
becomes
http://pbs.twimg.com/profile_images/34543543/image_name.jpg or image_name_bigger, ...
Source: https://dev.twitter.com/docs/user-profile-images-and-banners
I know this isn't the full code sample as requested (because there are several ways of doing this), but do you already have the URL for the avatar? I noticed that turning ".../eric.png" into ".../eric_bigger.png" resulted in the larger image. When "_bigger" already exists, removing it gave me the URL to the original image.
I tested this with several followers' profile images and, when the profile image was > 150px square, worked.
Twitter profile images urls:
Bigger: https://api.twitter.com/1/users/profile_image/puneetsindhwani/?size=bigger
Original: https://api.twitter.com/1/users/profile_image/puneetsindhwani/?size=original
I am trying to post a url to twitter but the url is user generated and dynamic...
TWEET THIS REQUEST
i started with that but its not catching the actual url- then i tried a few others but they seem to be for static urls
do i have to use the api or is there a way for this urlencode to read the specific url we want the users to publish?
thanks
UPDATE
TWEET THIS REQUEST
<p> <img target="Borrow this from someone on twitter" src="PHOTOBUCKET direct URL HERE" alt="TWEET THIS (IMPROVE YOUR SELECTION)" title="" border="0" /></p>
basically i want a combination of both- if you see "item=22" that is always changing- so i want a button where the code will actually read the CURRENT url not just a static one i added at the beginning... is this possible?
probably something like this?
<?php
$posts = array (
'i\'d like to borrow this item #neighborrow',
'test this very carefully',
'enough!!!'
);
foreach( $posts as $post )
{
?>
tweet this request <small>[<?php echo $post; ?>]</small> <br/>
<?php
}
?>
Liveview at codecookie.net
hope i understood it correct!
There's a pretty handy PHP Twitter API library here: http://lab.arc90.com/2008/06/03/php-twitter-api-client/
That'll make sure you don't have to solve problems that have already been solved and you can concentrate on writing your code.
I think a problem might be that you used "[ ]" the square brackets to surround the string, and you ended it with a period.
Other than that, I might suggest using something like htmlentities () or htmlspecialchars().
Alternatively, you might want to look into using the API to do this. For one thing, unless you're checking somewhere else, there's no way to guarantee the user is signed into twitter, and the API allows you to authenticate with twitter, plus the API is more likely to be supported longer than the query string request.
UPDATE:
I think the problem would be in this part of the code:
TWEET THIS REQUEST
You call a function called urlencode, but it's in the HTML part of the code, so the PHP is not going to execute that function, and the HTML simply parses it as plain text.
You'd want to replace it with this:
TWEET THIS REQUEST
That should let the php code parse that and return the encoded string.
I have been trying to attempt to use the facebook share function in my website but i cant seems to have the right result.
Say:
i have a page called http://www.example.com/product.php?prod=lpd026n&cat=43
and i am using facebook's share function to have visitors to share the page in the FB wall.
i tried writing the link this way but i doesn't seems to be successful:
href="http://www.facebook.com/share.php?u=www.example.com/proddetail.php?<?php print urlencode(#$_SERVER['QUERY_STRING']!=''?'?'.$_SERVER['QUERY_STRING']:'')?>"
as the result the arguments in the URL came out to be in %26, %3D and etc..
Ie: example.com/proddetail.php?prod%3Dlpd026n%26cat%3D43
as some of you may know that the data after '?' is dynamic and i am planing to use the code above in the frame of the page, so it will have different query passed to the share link in every new item.
The end result that i want got to look like this:
http://www.facebook.com/sharer.php?u=http://www.example.com/proddetail.php?prod=lpd026n&cat=43
Not
http://www.facebook.com/share.php?u=http://www.example.com/proddetail.php?prod%3Dlpd026n%26cat%3D43
can anyone help me to solve this problem?
Thanks in advance!
Ps: if you are unclear, please ask me to further clarify.
This URL:
http://www.facebook.com/share.php?u=http://www.example.com/proddetail.php?prod%3Dlpd026n%26cat%3D43
is only partially-encoded. You actually need to fully URL-encode it before passing to FB, so that it won't interfere with FB's URL structure. I'm sure that their script will know how to parse it properly.
The correct method is:
$url = 'http://www.facebook.com/sharer.php?u='.urlencode('http://www.example.com/proddetail.php?prod=lpd026n&cat=43');
// evaluates to:
// http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.example.com%2Fproddetail.php%3Fprod%3Dlpd026n%26cat%3D43
Update: build your dynamic query
// Original URL
$url = 'http://www.example.com/proddetail.php';
if ($_SERVER['QUERY_STRING'])
$url .= '?'.$_SERVER['QUERY_STRING'];
// Final URL for FB
$fb_url = 'http://www.facebook.com/share.php?u='.urlencode($url);
This is what urlencode does, what is the problem with the link this way?
Edit: I do not use PHP, but I think the following will do the trick (omitted the urlencode):
href="http://www.facebook.com/share.php?u=www.example.com/proddetail.php?<?php print $_SERVER['QUERY_STRING']?>"
I guess K Prime is right.
u need to encode the whole url because the slashes and ":" are still causing problems in this link ;)
$url = 'http://www.facebook.com/sharer.php?u='.urlencode('http://www.example.com/proddetail.php?prod=lpd026n&cat=43');
should be fine for your purposes.