We building video sharing site using jw player 5,
and struggling here
example 1:
'backcolor': "{/literal}{$smarty.const._BGCOLOR}{literal}",
'frontcolor': "{/literal}{$smarty.const._TIMECOLOR}{literal}",
'screencolor': "000000",
'repeat': "false",
'logo': "{/literal}{$smarty.const._WATERMARKURL}{literal}",
'linktarget': "_blank",
'link': "{/literal}{$smarty.const._WATERMARKLINK}{literal}",
'image': "{/literal}{$video_data.preview_image}{literal}",
'sharing-3': {
'link': '{/literal}{$video_data.video_href}{literal}',
'code': encodeURIComponent('{/literal}{$embedcode}{literal}')
}
And how to add this part into example 2:
'sharing-3': {
'link': '{/literal}{$video_data.video_href}{literal}',
'code': encodeURIComponent('{/literal}{$embedcode}{literal}')
}
example 2:
$jw_flashvars .= '&config='. urlencode(_URL ."/players/jwplayer5/jwembed.xml"); // #since v2.2
$jw_flashvars .= '&backcolor='. _BGCOLOR;
$jw_flashvars .= '&frontcolor='. _TIMECOLOR;
$jw_flashvars .= '&screencolor=000000';
$jw_flashvars .= '&bufferlength=5';
$jw_flashvars .= '&plugins=timeslidertooltipplugin-2';
Related
I am using btcpayserver with bitpay php api. Trying to implement ipn in payments and send variables to email.
the ipn generates a log file like this:
Raw IPN: {
"id": "KrYtvetS9oQ9s7CDErk,
"url": "https://btcpayserv.net/invoice?id=KrYtvetS9oQ9s7",
"posData": null,
"status": "paid",
"btcPrice": "0.00162327",
"price": 11.99,
"currency": "EUR",
"invoiceTime": 1569570609000,
"expirationTime": 1569571509000,
"currentTime": 1569570697070,
"btcPaid": "0.00162327",
"btcDue": "0.00000000",
"rate": 7386.36657706093,
"exceptionStatus": false,
"buyerFields": {
"buyerEmail": "buyeremail#test.com"
},
"transactionCurrency":
the ipn get data like this in php: $ipn = json_decode($raw_post_data);
php
$ipn = json_decode($raw_post_data);
$invoice = $client->getInvoice($ipn->id);
$invoiceId = $invoice->getId();
$invoiceUrl = $invoice->getUrl();
$invoiceStatus = $invoice->getStatus();
$invoiceExceptionStatus = $invoice->getExceptionStatus();
$invoicePrice = $invoice->getPrice();
$invoiceBtcPrice = $invoice->getbtcPrice();
i could send some fields like this via php mail:
$message = 'Date:' . $date . ', ID: ' . $invoiceId . ', Status: ' . $invoiceStatus . ', Url: ' . $invoiceUrl . ', BTC Price: ' . $invoiceBtcPrice . ', Price: ' . $invoicePrice;
but i will like to send this variable of the RAW IPN: "buyerEmail": "buyeremail#test.com"
can not make it.
I have a problem, I would try to download all the json generated by this url
https://api.github.com/repos/xxxx/xxxx/contents/xxxxxxx?ref=master
I have a json result like that
[
{
"name": "xxxx.png",
"path": "xxxx/xxxx.png",
"sha": "8b33da362caab310626daa2b70b232a98b38c6db",
"size": 136356,
"url": "https://api.github.com/repos/xxxx/xxxx/contents/xxxx/xxxx.png?ref=master",
"html_url": "https://github.com/xxxx/xxxx/blob/master/xxxx/xxxx.png",
"git_url": "https://api.github.com/repos/xxxx/xxxx/git/blobs/8b33da362caab310626daa2b70b232a98b38c6db",
"download_url": "https://raw.githubusercontent.com/xxxx/xxxx/master/ModuleInfosJson/xxxx.png",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/xxxx/xxxx/contents/xxxx/xxxx.png?ref=master",
"git": "https://api.github.com/repos/xxxx/xxxx/git/blobs/8b33da362caab310626daa2b70b232a98b38c6db",
"html": "https://github.com/xxxx/module_apxxxx/blob/master/xxxx/xxxx.png"
}
}
]
I write this but it does'nt work and I have this message : failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
Warning: fopen([{"name":"xxxxxx.png","path":"xxxxxx/xxxxxxx.png","sha":"..............
My directory is in 777.
$json = #file_get_contents($this->GetGithubRepo() . '/' . $module_name . '/contents/' . $this->ModuleInfosJson . '?ref=master', true, $this->context );
file_put_contents(OSCOM::getConfig('dir_root', 'Shop') . $this->ModuleInfosJson . '/Cache/' . $module_name . '.json', fopen($json, 'r'));
but if I write the code like that, it's ok but I need the information like sha, git ..., That's I need, not in this case.
$download = 'https://raw.githubusercontent.com/ClicShoppingAddsOn/' . $module_name . '/master/' . $this->ModuleInfosJson . '/' . $module_name . '.json';
file_put_contents(OSCOM::getConfig('dir_root', 'Shop') . $this->ModuleInfosJson . '/Cache/' . $module_name . '.json', fopen($download, 'r'));
Thank you.
I found a solution
$local_file = OSCOM::getConfig('dir_root', 'Shop') . $this->ModuleInfosJson . '/Cache/' . $module_name . '.json';
$remote_file = $this->GetGithubRepo() . '/' . $module_name . '/contents/' . $this->ModuleInfosJson . '?ref=master';
$ch = curl_init();
$fp = fopen ($local_file, 'w+');
$ch = curl_init($remote_file);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_exec($ch);
curl_close($ch);
fclose($fp);
I want to get data from the API iTunes Store to my PHP file. In the search form you can fill the artist and title of the song. I want to show only the data from the song. This is my code:
$title = $_POST["title"];
$artist = $_POST["artist"];
$query_string = urlencode($title);
$query_string2 = urlencode($artist);
$json = file_get_contents('https://itunes.apple.com/search?term=$query_string&term=$query_string2'); // this WILL do an http request for you
$data = json_decode($json);
echo "<div class='container' id='movies'>";
echo "<div class='col-md-4' id='movie'>";
echo "<img src='" .$data->artworkUrl60. "' width='200'>";
echo "<h4>" .$data->artistName. " - " .$data->trackName. "</h4>";
i get this error: Notice: Undefined property: stdClass::$artworkUrl60 in....
Whats wrong with my code?
Because your $data Object doesn't contain an attribute named $artworkUrl60.
Your HTTP query doesn't not work correctly, you should use double quote instead of single quote.
// For limit you can add 'limit' parameter
$json = file_get_contents("https://itunes.apple.com/search?term=$query_string&term=$query_string2&limit=20");
// OR concatenation
// $json = file_get_contents('https://itunes.apple.com/search?term='.$query_string.'&term='.$query_string2);
$data = json_decode($json);
if (0 == $data->resultCount) {
echo 'No result found ! ';
}
else {
foreach ($data->results as $row){
echo "<div class='container' id='movies'>";
echo "<div class='col-md-4' id='movie'>";
echo "<img src='" .$row->artworkUrl60. "' width='200'>";
echo "<h4>" .$row->artistName. " - " .$row->trackName. "</h4>";
}
}
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#searchexamples
So i just started using Phpstorm and I am trying to 'correct' my code so there are no errors from the IDE. I have the following method below and all my xml tags are highlighted with the 'Unknown HTML tag'
What is the best way to correct this?
private function generate_qbxml_CustomerAddRq($requestID=0){
/** requestID is used when multiple requests are called in order to match the request to the response.
requestID's should be incremented as they are called. Currently not implimented. **/
$qbxml = '';
$qbxml .= '<?xml version="1.0" encoding="utf-8"?>';
$qbxml .= '<?qbxml version="2.0"?>';
$qbxml .= '<QBXML>';
$qbxml .= '<QBXMLMsgsRq onError="stopOnError">';
$qbxml .= '<CustomerAddRq requestID="'.$requestID.'">';
$qbxml .= '<CustomerAdd>';
$qbxml .= '<Name>'.$this->Name.'</Name>'; //Name is a mandatory field. Add a check for this.
/** For all optional values add a check so that xml tags are not sent in request if value is blank**/
$qbxml .= '<CompanyName>'.$this->CompanyName.'</CompanyName>';
$qbxml .= '<FirstName>'.$this->FirstName.'</FirstName>';
$qbxml .= '<LastName>'.$this->LastName.'</LastName>';
$qbxml .= '<BillAddress>';
$qbxml .= '<Addr1>'.$this->BillAddress->get_Addr1().'</Addr1>';
$qbxml .= '<Addr2>'.$this->BillAddress->get_Addr2().'</Addr2>';
$qbxml .= '<City>'.$this->BillAddress->get_City().'</City>';
$qbxml .= '<State>'.$this->BillAddress->get_State().'</State>';
$qbxml .= '<PostalCode>'.$this->BillAddress->get_PostalCode().'</PostalCode>';
$qbxml .= '<Country>'.$this->BillAddress->get_Country().'</Country> ';
$qbxml .= '</BillAddress>';
$qbxml .= '<ShipAddress>';
$qbxml .= '<Addr1>'.$this->ShipAddress->get_Addr1().'</Addr1>';
$qbxml .= '<Addr2>'.$this->ShipAddress->get_Addr2().'</Addr2>';
$qbxml .= '<City>'.$this->ShipAddress->get_City().'</City>';
$qbxml .= '<State>'.$this->ShipAddress->get_State().'</State>';
$qbxml .= '<PostalCode>'.$this->ShipAddress->get_PostalCode().'</PostalCode>';
$qbxml .= '<Country>'.$this->ShipAddress->get_Country().'</Country> ';
$qbxml .= '</ShipAddress>';
$qbxml .= '<Phone>'.$this->Phone.'</Phone>';
$qbxml .= '<AltPhone>'.$this->AltPhone.'</AltPhone> ';
$qbxml .= '<Fax>'.$this->Fax.'</Fax> ';
$qbxml .= '<Email>'.$this->Email.'</Email> ';
//$qbxml .= '<JobDesc>Ob2</JobDesc>';
$qbxml .= '</CustomerAdd>';
$qbxml .= '</CustomerAddRq>';
$qbxml .= '</QBXMLMsgsRq>';
$qbxml .= '</QBXML>';
return $qbxml;
}
Ok I figured it out myself.
Alt+Enter then select Add <'tag'> to custom HTML tags.
Similar to how you handle words that come up as typos.
You can mark the string/var as a 'language injection':
Place the caret inside the string literal, tag, or attribute, in
which you want to inject a language and press Alt+Enter (or use the
intention action icon Intention action icon).
Select Inject language or reference and choose the language you want
to inject.
https://www.jetbrains.com/help/phpstorm/using-language-injections.html
The result looking like this:
$xmlString = /** #lang XML */
'<?xml version="1.0" encoding="utf-8" ?>';
INFO: I am using [ MySQL 5.5.16 ]-[ PHP 5.3.8 ]-[ jqSajax 1.0.2 ]-[ JQuery 1.2.2 ]
PHP, MySQL, Apache and HTML header are charset UTF-8
I have been working on this for three days.
One database:
tblitems InnoDB
tblarticles MyISAM FULLTEXT
PROBLEM: I cannot insert a large amount of text with a simple insert because I have special characters ” “ ’ ‘ — …
QUESTION: How do I insert a large amount of text into a LONGTEXT field with special characters ” “ ’ ‘ — …
SEARCHED/TRIED: See code below and MySQL output at bottom
encode IN Javascript AJAX encodeURL()
decode IN PHP urldecode() to build SQL Query
CODE:
=========== create javascript ==========
<?php //calls php function through jqsajax
$strOnClickString = "$('#none').html(";
$strOnClickString .= '$.x_Add_Item(';
//$strOnClickString .= "$('#sel_txtPublication').val()"; //$strPublication
$strOnClickString .= "'Co-Worker Letters'"; //$strPublication
$strOnClickString .= ", $('#sel_txt_Title').val()"; //$strTitle
$strOnClickString .= ", $('#sel_txtMonth').val()"; //$strMonth
$strOnClickString .= ", $('#sel_txtYear').val()"; //$strYear
$strOnClickString .= ", $('#sel_txtAuthor').val()"; //$strAuthor
$strOnClickString .= ", encodeURI($('#strArticle').val())"; //$strArticle
$strOnClickString .= '))';
echo Create_Input('button','Submit Text','10','btnSubmit','btnSubmit','onclick',$strOnClickString); ?>
========= PHP create SQL ===========
//=========================================================================
function Add_Item($strPublication, $strTitle, $strMonth, $strYear, $strAuthor, $strArticle){
//=========================================================================
$sql1 = "";
$sql = "";
$sql1 = "INSERT INTO `hwa_archive`.`tblarticles`";
$sql1 .= "(`strArticle`)";
$sql1 .= " VALUES (";
if ($strArticle != 'ignore')
{
$sql1 .= '"' . urldecode($strArticle) . '", ';
}
$sql1 .= ")";
$sql1 = str_replace('", )','" )',$sql1);
$res2 = mysql_query($sql1);
//$res2 = mysql_query('SELECT LAST_INSERT_ID()');
$intArticle_ID = mysql_insert_id();
$sql = "INSERT INTO `hwa_archive`.`tblitems`";
$sql .= "(`strPublication`, `strTitle`, `strMonth`, `strYear`, `strAuthor`, `intArticle_ID`)";
$sql .= " VALUES (";
if ($strPublication != 'ignore')
{
$sql .= "'$strPublication', ";
}
if ($strTitle != 'ignore')
{
$sql .= "'$strTitle', ";
}
if ($strMonth != 'ignore')
{
$sql .= "'$strMonth', ";
}
if ($strYear != 'ignore')
{
$sql .= "'$strYear', ";
}
if ($strAuthor != 'ignore')
{
$sql .= "'" . $strAuthor . "', ";
}
$sql .= "'$intArticle_ID', ";
$sql .= ")";
$sql = str_replace("', )","' )",$sql);
$res2 = mysql_query($sql);
Return $intArticle_ID . "<br /><br />" . $sql . "<br /><br />" . $sql1;
}
MySQL OUTPUT:
YOUR Part in the World’s Network (’ needs to be a single curly quote ’)
YOUR Part in the World%u2019s Network (%u2019 needs to be a single curly quote ’) no decode in add_item
I hope this info is not overkill.