I am using Phaxio for send FAX and it's working fine till now.
Now i have to add some extra stuff to it. I want to generate some of the data in new pages into same PDF(generate PDF on success of send fax by phaxio).
Currently its being generate new pages only when while it's come up at bottom of the page.
i tried following code by paging paging parameters as given on Phaxio official site http://www.phaxio.com/docs/paging/ but it's not working at all or might be i don't know how to use it.
Please take a look at following code.
require ("Phaxio.php");
$apiKeys['test']='xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$apiSecrets['test']='xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$apiHost='https://api.phaxio.com/v1/';
$filename='html_data.html';
$toNumber="my-10-digit-phone-no";
$phaxio=new Phaxio($apiKeys['test'], $apiSecrets['test'], $apiHost);
$phresult=$phaxio->sendFax($toNumber, $filename,
array('maxperpage' => '400','page' => '1'));
echo "<pre>";
print_r($phresult);
if ( !$phresult->succeeded() ) {
echo ("<H4>Error sending fax to $toNumber with " . $phresult->getMessage()."</H4>");
return FALSE;
}
else {
echo ("<H4>Your fax has been sent.</<H4>");
return TRUE;
}
After spending couple of hours i finally got a very silly but useful solution.
Actually my requirement was that in my FAX PDF there was number of repeated HTML was there like generate invoice in same format(using loop), and i really need like every invoice HTML should be in separate PDF page.
So I've simply used CSS style="page-break-before:always;" and i was done with my issue.
1) via CSS - for the advanced HTML users:
<p style="page-break-after:always;"></p>
2) with a simple comment:
<p><!-- pagebreak --></p>
Related
I want to create handy message like in this channel
All I've done is just here code sample
$bot = new \TelegramBot\Api\Client('xxx:yyy');
$bot->sendMessage("#dtsautocom", "<a href='https://dts-auto.com/{$passanger_car->main_photo}'>{$passanger_car->name}</a> \n{$passanger_car->year} год, {$passanger_car->price} $, пробег - {$passanger_car->mileage} км \nТелефон продавца: {$passanger_car->phone}", 'HTML');
$bot->run();
I wrapped image link to a tag and I get image, but this is not good solution and I've got this. I want to create like in the first link above. How did they do this? Can anyone give me please code sample of how to do it in right way? Thanks.
They used sendPhoto method with parse_mode set to HTML and formatted photo caption.
For your API library it should be:
$bot->sendPhoto("#dtsautocom", "https://dts-auto.com/{$passanger_car->main_photo}", "{$passanger_car->name}\n{$passanger_car->year} год, {$passanger_car->price} $, пробег - {$passanger_car->mileage} км \nТелефон продавца: {$passanger_car->phone}", null, null, false, 'HTML');
I am currently using simple_html_dom to parse some MP3 files from another website, and store them onto my own server. However I've noticed that some of them contain a tag which indicates the location they originated from within the comment portion of the ID3 properties.
I need to make this website, say my own websites name. However, the only solution that I've found to doing this with PHP is beyond complicated using something called GETID3.php You can view the github link by clicking the name.
I don't really understand the documentation can someone help me find an easier way of doing this please?
Here's the part of my code that matters, I guess.
$mp3title = ''.$thetitle.' - Oursite.com';
file_put_contents($DPATH.'/temp/'.$mp3title.'.mp3',file_get_contents($filepath));
$file = $DPATH.'/temp/'.$mp3title.'.mp3';
Provided you're not interested in also updating the image of the file, you can look into just using something simple like the default php function id3_set_tag however for more complex usages like updating the artwork then you're going to have to use the library you mentioned before.
$data = array(
"title" => "Re:Start",
"artist" => "Re:\Legion",
"comment" => "YourWebsiteName.com"
);
$result = id3_set_tag($DPATH.'/temp/'.$mp3title.'.mp3', $data, ID3_V1_0 );
if ($result === true) {
echo "Tag successfully updated\n";
}
using twilio, trying to return a list of text messages sent to a specific number...with no luck
foreach ( $client->account->sms_messages->To(+12345678901) as $sms ) { echo $sms->body; echo "</br>"; }
the problem is obviously the "To(+12345678901)"
I have tried using single and double quotes, numbers owned and not owned, and several other parameter formatting options, I cant seem to get lucky here. Please help.
Twilio Developer Evangelist here.
You've almost got it. The part you're missing is using the getIterator method for filtering. You pass this an array containing the data you're filtering on. Here's a code snippet:
foreach ($client->account->messages->getIterator(0, 50, array(
'To' => '+12345678901',
)) as $message) {
echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body;
}
You can read a bit more about filtering messages in our docs. The docs for our PHP helper library also have some good examples.
GA: content>event>overview>event label.
I am using download tracker and I would like to make my reports "user friendlier",
the problem is, "this.href" function provide the "label" section in GA the name, which in that case takes the whole url (href="http://nameTheWebsite*/wp-content/uploads/2010/07/somethingToRead.pdf") and I would like to see only "somethingToRead.pdf" in my report.
the tracking code is:
_gaq.push(['_trackEvent','Download','PDF', this.href]);"
I am using WP.
now, I did some homework, and I believe that substr(this.href , -10) function could help but I don't know how to do it right.
Any help would be highly appreciatedץ
Thanks in advance.
Gal
substr(this.href, -10) will only work correctly, whenever the filename is accidentially 10 characters long.
A more sophisticated solution would be something like this:
var page = this.href.splitOnLast('/'); // this should return an array with two elements: path and filename
page = (page.length > 1) ? page[1].substr(1) : page[0]; // just in case there is no / in the this.href
_gaq.push(['_trackEvent','Download','PDF', page]);
Now you should get "somethingToRead.pdf" in your Google Analytics tracking.
I am using the Google Analytics PHP class to get data from Google Analytics.
http://code.google.com/p/gapi-google-analytics-php-interface/wiki/GAPIDocumentation
I would like to get a report of "Bounce Rate" For "Top Contnet".
The thing is I am not familiar with the terminology.
When I am trying to get a "content" report or "topcontent" or "top_content" it says that there in no such metric. I simply don't know the right expressions.
Does anyone know where can I find a list of all expressions? metrics & dimensions?
Thanks.
Top content isn't a metric, it's just a list of the pages on your site with the highest number of page views.
The metric you're looking for is 'entranceBounceRate' and the dimension is 'pagePath'. You want to get the bounce rate for the top X most visited pages on your site, so you'll want to limit your results and sort the results by '-pageviews' (pageviews descending).
If you want to get the bounce rate for the top 10 most viewed pages on your site, your query should look like this:
$ga = new gapi('email#yourdomain.com','password');
$ga->requestReportData(145141242,array('pagePath'),array('entranceBounceRate','pageviews'),array('-visits'),null,null,null,10);
The Google Analytics Export API has a data feed query explorer that should help you out considerably when using GAPI:
http://code.google.com/apis/analytics/docs/gdata/gdataExplorer.html
Also, here's a list of all available dimensions and metrics you can pull from the API:
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html
Definitely read over the GAPI documentation:
http://code.google.com/p/gapi-google-analytics-php-interface/wiki/GAPIDocumentation
If you would like to get the global Bounce Rate for the last 30days (by default), here is how. Very simple once you know it.
//Check Bounce Rate for the last 30 days
$ga = new gapi(ga_email, ga_password);
$ga->requestReportData(145141242, NULL ,array('bounces', 'visits'));
$data = round(($ga->getBounces() / $ga->getVisits()) * 100) . "%";
Note that the GAPI has a bug, they mention the dimension parameter is optional (2nd parameter) but it's not. You have to open the gapi.class.php file and patch line 128 with this:
//Patch bug to make 2nd parameter optional
if( !empty($dimensions) ) {
$parameters['dimensions'] = 'ga:'.$dimensions;
} else {
$parameters['dimensions'] = '';
}