Check, if is allowed embedding ( youtube video ) PHP, new youtube API [closed] - php

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
can someone hep with replace old way to new YouTube API?
I am looking for check option - allowed embedding.
My old code in PHP:
$url="http://gdata.youtube.com/feeds/api/videos/" . $videoID . "?v=2&alt=jsonc&prettyprint=true";
$json = file_get_contents($url, true);
$json_output = json_decode($json);
echo "emb = ".$json_output->data->accessControl->embed;
I am looking for easy, fast code, because i need to check more videos at time.
Thx.

The new base URL to get information about a video, through the ID, like http://www.youtube.com/watch?v=abcdefghijkl is:
https://www.googleapis.com/youtube/v3/videos?id=abcdefghijkl&key=YOUR_API_KEY&part={parts you want}
To get the status, if it's embaddable you have to set part to status, so your request looks like this
https://www.googleapis.com/youtube/v3/videos?id=abcdefghijkl&key=YOUR_API_KEY&part=status
The response output will look something like this:
"status": {
"uploadStatus": "processed",
"privacyStatus": "public",
"license": "youtube",
"embeddable": true,
"publicStatsViewable": true
}
Source: YouTube API - Getting started and YouTube API - Reference Videos
I didn't test it, but I hope it will work and I could help you!

Related

How to print the logged in user name on Woocommerce My Account page? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I'm struggling with printing the logged in user name on the My Account page of Woocommerce. I have a function that looks like this:
add_action( 'woocommerce_order_details_before_order_table_items', function() {
_e('<p class="you-ordered">Hey! Here\'s what you ordered:</div></p>');
} );
I'm trying to get it to say: "Hey, Jim! Here's what you ordered:".
I've tried:
add_action( 'woocommerce_order_details_before_order_table_items', function() {
_e('<p class="you-ordered">Hey! '.$current_user->display_name.' Here\'s what you ordered:</div></p>');
} );
But that didn't work. Any ideas?
Here's the solution:
add_action('woocommerce_order_details_before_order_table_items', function() {
$current_user = wp_get_current_user();
_e('<p class="you-ordered">Hey! ' . $current_user->display_name .
' Here\'s what you ordered:</div></p>');
});

When fetching questions using Stack Overflow API, the output is garbled

I want to get some questions from Stack Overflow API. I have done the following things:
All the 3 steps executed successfully.
Requested user to approve the app: https://stackexchange.com/oauth/dialog?client_id=4783&scope=private_info&redirect_uri=https://stackexchange.com/oauth/login_success
Get the access token from the user using this link: https://stackexchange.com/oauth/login_success#access_token=..&expires=86399
Go to the content page from where I have to get the data: https://api.stackexchange.com/2.2/questions?order=desc&sort=activity&site=stackoverflow&key=Z19xwkOfreckWgqMe7OiZg((&access_token=..
I am using
file_get_content("https://api.stackexchange.com/2.2/questions?order=desc&sort=activity&site=stackoverflow&key=Z19xwkOfreckWgqMe7OiZg((&access_token=..")
to get data and print it. However data printed in browser I like this:
‹½\ýoÛ6·þWˆØ/oQõÕ‹bè׶nëÚ5Ûºíâ" $ÊfbK®$Çñ†ýïï9¤äȱåHYwƒv$>Ç"ùø|3éF-볧ÿû×Y#gøæLÖ«óB5Tgªht³={rp‰r{qoØÿ=9+7…ªÎžþuV©Õº‘.‹³§‚‹'gëZU—:;{êA¸q{¥Ù®ÔÙS>Óu£*•¡Ü4U«æ²’ ÜŠÂ'g«ªÌõB]꥜áèyÓ¬ž:Ž>¯™^Ÿëål]§åÒñ~¯ëóU1ûª~æòèËÙ3äeº^-äö²KDX§sYÀõ….®ï¤YåªòE¹1Òðk§}^§²°¿ŸœéúRõÆ<íÓ\.jõäìF«ÍeZ®‹æìiS0÷»î“³:-+øpŸ*ëæR¦¾5»ÌÌ$]á¹A( i¥ÌºõoAä-TeºÙƒ1?±ŸÖª60\cqß½øá9v°Úé0Îf® ºÑ‹…:ßÎe=WÙJÖõ¦¬2Z©z½hh¢h½†ªëJáˆB©ÌìPaËüÄC~5b¾5bÞ·bˆCE.¬˜FÌVÌßOîèx%odVzÕ 7ŠÙz!««Þ—É•J›AÚ¹,èÑνÀFÓÎelïªúu­Î¯V'yWèëk²)‹ÙhêµÏì ’äöEgŸ{œ}¡ÜèüÈãS†˜.f´þ´–•¢IÕÔT5¨*j7–®u»‚7*£My­Š¹~A ÄJ b%Y+á)ùe'‚ülDÜ'îûJ¦s5H#Ïí±H„.‹„‚EÇ8SÃÂl6›óYŸØHËûÖÉx°HªLxaœ$øew}îJÎb•ÃÍ–QÙ3«fÓ²ø²zöþ›/óc»–ëŲ,t=ͱvFN:‚d.4ËüøËxãxke<C7 Ø–uÇî+Í*TekMaº€ ‰.2¤Ÿ®ëµêQê¹N^ápòËb‡“v8±ÃѧȪRãÖÏ›å +d'¼»ªËõj˜X}^Eq ï3òÊeqè'iæEcA–ñ8U¾¥a¤„'¹;‰W¯³åºÈÊñ¤²ÓqT‹»Ï¨¦Zß'”ÿy ·Xà‰#†”ªïOT[ã˜í¤ê¶©ðI€BK°`zµPT-ÔVum€s5,mô²Ï¯ï.ÞýòžÜ¡I‡&ô4A41è>ÝÒÿümÞJ*+Š»(ef™–WZÍ×EjÈ5h¯O»À|¼MŒùtƘ¦i 3•ä" ?Î/¤‡< á!ßÊ+‘çê¥MC;=g‰P* tÝa&º0qÀ}½ÈCî›…WãÕM4®€qŽ1„¦r±À×{<¿Ë%]ªeŠqGž;ξke‘ž¬§¤F¬0Òá #VØîâ…u‰n›^ÍË¿™ªõ¬ +ÙÝ ¼%«tñHÚ¬«aƒÌA¹ôU'¸ç,Íaw:‡ýØÏ£˜+ž‹+'BÉ4=æ‰ÍáDžáKÜÕѺÔÌÏÙÃŽ±ÐÈÅEY«¬Ï6¢ï>¿ÙŽßô!‚ó£÷ã0òã;PÃB„ÑT5ŒXAÜ¥ ±•«Ý#Înâð¤52vöû–”+] ñYïE+úÝ¡äÃXò|µ"ÏûbûLž•åô>~´*fÚÐyVRÖDo;ÆF~ Ø)[¿ÏX1±Ryà? éyIŠV‚à‚ºe“"ËÊCÆþ¬—ËÑLµórÄŒ`¨8¡h2ùÇ"Wø¡ïñð]pÁÃûŠ–¢iqr‡q*´(P«ÎþÔÀ¯`Ä4e¦UMg{éÈö¡C’o,’tHb‘´)òïµEñ:—Ûú:›WY’âKRÖõ°Õß÷4#óái.æþ¹å=B3 pÇ,½Üpþâí7¿mK统7»÷/âçÎíïl…¾Ì³&rÀ4¥—ÿD&ï×+²˜ân✜›+º¥œM6–y"0ñÜw½a ˆ°CÏÝp²‰Œ3Sñ?+xvp©ª*°÷›9ìmª-ÞjJ ;T`m¨b-}KžŽ‡ßX9¤•CŒbä+‡4%iå#Çy#gÏ9ýÄnV¹ÙHcøe…yCu›.Ö™á~ jªÈ¾†ÌsGç‡s5 Wóó\¦*)Ëk³ .ß,ƒÂ•6úý+ü˜gYÍÔ!¿WÅ—_xñÿh°ä­lêõV.åx‚Úù8ת# t¹“ð°?ê¨I>ÖCþ¨`ÑýPÛ+§0NJíF#ó0»W[ºíQ¡#ÝË/Èn01ƒ-§zƒ‡³WòÖdl0تÅpp½¯òRoÅ#¢’õê–®`]¢±™WŠûÙöŠô(‚8‚8T9ˆ#ˆ3:ÅââÚ‘ƒòÔ¸|‹"÷s6Äye\æaœ¡Ïݘ³Œå^Kæ哬׫íBäÕ„d‚™Ž“!Žfÿ4JÅ:^CB†5CTïH LvÌM5oA`jHàÔ¤à>£-S· +=›7¶-„nh:Ÿ¹Vð*±`u¯Zô²ƒ„·m"dã—¯;ü¾o»FÆðÍã>NŸ3ôÃÄõ7Qiœ†~¥A&O²„‰ÌÄ´ü>Uûˆã}&;ÞécGð.~´ÚâM"Šã©Ðxj“ˆÁÇ)…ïö¡ß”ma™t ~J…ÙQ‰“Îh™Ã+ÒÜp/× lž.è]3Qßwy’Ðujå+\{“‘2‡××­<ò5ÊÃÔC'ï~ú¡g»J’É­zM}õçîyS+HC¹xÎh˜’"£²ñä&sY\OˆÛÇvàë{Ó‚ÇøP'Â#Ê`ÝPµâ“hX×ñ£Õ¢ ˜î`Æýîj#庢#ˆÍ`—iR‚M-WVÖja[-oäbÏyxWú8ypò àäEyKÞ·prÑÂɯÞ盺Mì&‘¶"¤ßr­ß-î‰ØýÑíþ#%è”2Lcá†^¬”HóÜWqÇLº™RótehŸy¼2´ã>ö_MO𡬽u,=!‘žN½Nl®–ëu^%‹YW¯„ø±#åW•›Ý.:ª5iK“%þˆúí#UZ ZE›4›åðp\_›yœyâ”qÝÏMøÓÔ[ÀBæ3ߥ×. Pö±ãd¼V³ïÔÅ p3*³*þ?©ã=‚:°^˜n0ûˆþ?6U®*u£ËuM7*1¡ØK»ñwðp1ôý±•²Ãƒ61Ç\1$Ðr3Kôžz¹Q‹2=u²å^c…‡Ÿ3* ½ÿ,U±çJÆ„.¼œI/á®ê<®˜ÞÊʪáÑ-8giaÿj¶žEöÖ1N=âÜAÀ Œj·”v{½g_7ó#ž×›šüÚŽ&w£ Žîüª¯ŽµæÈ50÷C¶Ý”%^ÁU]òöEGšœ‹~‹®çGÂ;Ū=õä!NÒ,,L¡| –ç&2ðUùIœ—¹q<±˜]5sNÈžšù9;Üà ݣGvD¸Gò§^€d7éŸ!‡ìàø‹ë‡üI¹ÕãlÚÔ)"7ÊJÿiÉd70‚Ð ÖtòÖ hl•»cÑÝù*›3ýxñŽ“=)&×RˆnLÓJMv¢l ü?ÊÝ«[xæ•ÊGUÃEÄc}Îc"ÌRž0X§ÌOC€ös3È)ü©:¯(¯&–‹Ú)âìøZÑABm´ös›tÂã µèq`º”¾é›€ÙÁ~d4Qª.BÒªMòÛbâbkyW”ÕR.(r‚.lãò½¼>J$­D‚‰•HÀc³™þN¢¥Ÿ•HP"A‰G’û»è´=xŠj3ÍÍYu*m²—۽РGçpƒGÄ9…LГ‘ÏÝ(æyG2SƲñÇd­s¢?%r¼‰n§ç ”Zè£Z7Æ3Õê}ŒÙ)åéÍܹÓó+€qÒuÝ+Á™3‡¸ jAí™B ‰9ç¥S›)úPKŸ]û™Á‹Gwð;ƒ'O>¾üš´x£E;úíÔT¨ä#¥l*=œ7ñú5çÜS|œ\õôî¡ïù*ô„âYú>cH9D¯rZÞøy•©e²ØŽW•v>Žì€Ûn4²Ìà ²O°Þ#¼DÀ8•Ô†K’r n´©#Ðö¯"ãÒ~+·L$ᯈlÊÄFz½Ü5–òO0ót4Eeez­ÐDÙÛæÃIa¼ÔucÏxá*­PÄŒ›ºË#š¼ÅP“÷þw?¼ø¤çÁo›£MÞÏ_¼v~ú)Ò¼ò·?æõˆ&ïodµ%ï!^›pÆÎÌ™”BÿYlòБw8àuÞéw<®j·×œ°$QiM[ôõ{wa˜aäõËÒ ;–v«Ëª9U¿Ï|ÎJCêgR²”{±÷—'R€‡—»,Ëc°˜¡?IC}/‹Ù|»†/Õ¼ °„MSD?¦ÚÀdz† UÏ‹»…8Ö.Æä *bœvçi±Æ#yæpª¤3½A%¨l£Ë:–tôj1¤Å˜1b0xÁbîwÏ>1•×Y¥NµÒF{Evî‡~p’nÿà2¸•¿Nª²ÿ ÊbBV¤}`gaaÿêÿaƒ=dŒ Ÿ4ìhsFðˆæÀ89| \¤kïv‚[´?9zô}/ëk‹#kß[ÜÅO?W-θW_[Ü‘#ö¨\7¦›ñFæ·»7ÍÖ¸6•\­Néµ Ú¥MlÄ‹ødÕj¿¡ã=hi+žò< #<GJd¾ë',vU–«ÑÁÀÌ.8Uã#;7§Ã<|—àÛí¥\¶ÌDê´×ÌÊúŽZœ‡±ÏÈ<:t`ǃ\ÁÃS'£ƒàþù­(ð'v}[Œ³‚€SU°"]­ßaÑÇ©Ê­¯ÑµÃÔ…uÿÅ`ôB&{:ò}'§+ú›âk+‡ r'î´rˆ•ó7v.ëË¥Y7ë"Z—¼\Ê[³ö+ŒW*µ´RÀűÿ÷£¼ø®I
How can I retrieve the page data. This data is not in JSON form.
For future reference, #sachinmanit found answer to his question as mentioned in the comment. I’ve copied it here for clarity:
The response is in Gzipped, so the response needs to be extracted in order to read it. The way #sachinmanit handled it is following:
$json = file_get_contents("api.stackexchange.com/2.2/…");
$json_data = json_decode(gzdecode($json), true);

free and paid registration guest user in my website using paypal using php please help me [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
In my site i want to free and paid membership.
I am new in paypal integration. How to use paypal payment system please help me.
After insert this detail in database and how to redirect on paypal.
Duration : 1year, 2year and lifetime membership
Prize :$10 ,$20, $100
Here is my PHP code
function payment_info()
{
global $obj;
$jobseeker_id = $_SESSION['jobseeker_logged_in_id'];
$s=$obj->FetchObject("SELECT * FROM candidate_registration WHERE jobseeker_id='".$jobseeker_id."'");
$fname =$s->candidate_fname;
$candidate_lname =$s->candidate_lname;
$candidate_name =$fname.' '.$candidate_lname;
$candidate_current_location =$s->candidate_current_location;
$candidate_mob =$s->candidate_mob;
$candidate_dob =$s->candidate_dob;
$candidate_gender =$s->candidate_gender;
$email_id =$s->email_id;
$duration = $_REQUEST['item_name'];
$pid = $_REQUEST['item_number'];
$prize = $_REQUEST['amount'];
$sql_data_array=array('pid'=>$pid,
'jobseeker_id'=>$jobseeker_id,
'duration'=>$duration,
'prize'=>$prize,
'email_id'=>$email_id,
'jobseeker_name'=>$candidate_name,
'candidate_current_location'=>$candidate_current_location,
'candidate_mob'=>$candidate_mob,
'candidate_gender'=>$candidate_gender,
'candidate_dob'=>$candidate_dob,
'membership_status'=>'1',
'membership_date'=>'now()');
$obj->Insert('jobseeker_member',$sql_data_array);
$_SESSION['success']="user detail added successfully";
header("location:");
}
on the above code after this line $obj->Insert('jobseeker_member',$sql_data_array); you want to set your paypal integration which are redirect to paypal with all the elements in paypal.

Apache Fallback instead of add_rewrite_rule [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
My requirement is to do SEO Friendly URL for an existing site in Wordpress.
For example,
Current URL: http://localhost/test/?pid=19971
that is the page "test" is rendering the data from some custom plugin.
My new SEO URL : http://localhost/brand/sub_category/product_name
Here, Brand, Sub_category and product_name is fetched from the pid..
I am populating the data using the following rewrite rule from functions.php,
add_rewrite_rule(MY_DYNAMICALLY_POPULATED_URL.'$ page-test.php?brand='.$brand_name.'&sub='.$sub_category.'&pname='.$product_name.' [L]', 'top');
In this code, the page-test.php is placed in the root directory and the data is rendered from that file by passing the brand_name, sub_category and productname to fetch the pid. So based on the pid each product page is rendered.
This code is working fine for me, When I save the data automatically the data is written in .htaccess and page is rendering with the new SEO URL.
But when my client needs it to do it by FALLBACK in Apache instead of add_rewrite_rule due to some load balancing issue.
So can anyone help me how to do the same with Fallback resource.
This fixed my issue.
function my_query_vars($vars)
{
$my_vars = array( 'PARAMETERS' );
return array_merge($my_vars, $vars);
}
add_filter('query_vars', 'my_query_vars');
function my_rewrite_rules($rules)
{
global $wp_rewrite;
$my_page = 'PAGESLUG';
$my_rule = array( 'URL/?' => 'index.php?pagename=' . $my_page . '&school_type=$matches[1]' );
return array_merge($my_rule, $rules);
}
add_filter('page_rewrite_rules', 'my_rewrite_rules');

abraham/twitteroauth reply to a perticular tweet in PHP [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Hi i am totally new here and title says it all ..
i want to reply to a tweet using abraham/twitteroauth library for twitter .. update for the twitte is working fine but i am unable to do reply thing .
I am doing this ..
$status = $connection->post('statuses/update', array("status" =>
$dataa, "in_reply_to_status_id" =>$id));
twitteroauth_row('statuses/update', $status, $connection->http_code,
$parameters);
this code also updates the account with value in $dataa variable but do not reply to the tweet defined in $id
Please help .
Sorry for my bad english .This is my first post.
Thanks
yap . there was mistake from my side while updating the post .. after reading api document .. i found that without #username sign to perticular user it won't appear in his reply section ..
hamdoulilah the solution is so easy
you need just to add #username for who you want to replay to
$status_id = '480775609728385024';
$twitt_reply = '#username the replay text';
$responce = $connection->post('statuses/update', array('in_reply_to_status_id'=> $status_id , 'status' => $twitt_reply ));

Categories