how to pass Array as parameter in http body in iPhone - iphone

I have below code(httpbody for service) in php:-
<$xmlJobList = "<?xml version='1.0'?><Search><CompanyId><![CDATA[ $companyId ]]></CompanyId>"; $xmlJobList .= "<Offset><![CDATA[ $offset ]]></Offset><Limit><![CDATA[ $limit ]]></Limit>";$xmlJobList .= "<Keywords><![CDATA[ $keywords ]]></Keywords>";$xmlJobList .= "<FunctionalAreaId><![CDATA[ $farea ]]></FunctionalAreaId>**<IndustryTypeIds>"; foreach ($industry as $value){$xmlJobList .= "<IndustryTypeId><![CDATA[ $value ]]></IndustryTypeId>";}$xmlJobList .= "<Format><![CDATA[ $format ]]></Format></Search>";
and i want to write the HTTP body for iPhone/objective-c
PLease help me for this, i am working very 1st time for php.

Related

perl CGI radio button form

I have following CGI snippet from my code. its create textarea to type my message which i want to send, but i want to convert that into template style like "radio", so i select just radio button and it will inject whatever message into notification for customer, so i don't need to type message every time. just like template. Anybody has any example or code which can fix in my requirement?
use CGI;
use CGI::Carp;
...
...
$html .= $q->b("Customer Notification:") . $q->br;
$html .= $q->textarea(-name=>'notification',
-rows=>4,
-columns=>60) . $q->p;
$html .= $q->submit(-name=>' Send Notification ');
$html .= " ";
$html .= $q->reset(-name=>' Reset to Original Value ');
$html .= $q->p;
Like others have mentioned, you should really consider using one of the other solutions found in CGI::Alternatives.
Nevertheless...
my %labels = (
'comment' => 'General Comment',
'problem' => 'Non-critical Problem',
'emergency' => 'Critical Emergency',
);
$html .= $q->radio_group(
-name=>'notification',
-values=>['comment','problem','emergency'],
-default=>'comment',
-linebreak=>'true',
-labels=>\%labels,
);

How to make a email calendar invite automatically accepted (php)?

I'm sending a calendar invite via email but I want it automatically be accepted.
Is there something I can change in my code? My code looks like this:
function sendIcalEmail ($firstname, $lastname, $email, $meeting_date, $meeting_name, $meeting_duration) {
$from_name = “My Name”;
$from_address = “myname#mydomain.com”;
$subject = “Meeting Booking”; //Doubles as email subject and meeting subject in calendar
$meeting_description = “Here is a brief description of my meeting\n\n”;
$meeting_location = “My Office”; //Where will your meeting take place
//Convert MYSQL datetime and construct iCal start, end and issue dates
$meetingstamp = strtotime($meeting_date . ” UTC”);
$dtstart= gmdate(”Ymd\THis\Z”,$meetingstamp);
$dtend= gmdate(”Ymd\THis\Z”,$meetingstamp+$meeting_duration);
$todaystamp = gmdate(”Ymd\THis\Z”);
//Create unique identifier
$cal_uid = date(’Ymd’).’T’.date(’His’).”-”.rand().”#mydomain.com”;
//Create Mime Boundry
$mime_boundary = “—-Meeting Booking—-”.md5(time());
//Create Email Headers
$headers = “From: “.$from_name.” <”.$from_address.”>\n”;
$headers .= “Reply-To: “.$from_name.” <”.$from_address.”>\n”;
$headers .= “MIME-Version: 1.0\n”;
$headers .= “Content-Type: multipart/alternative; boundary=\”$mime_boundary\”\n”;
$headers .= “Content-class: urn:content-classes:calendarmessage\n”;
//Create Email Body (HTML)
$message .= “–$mime_boundary\n”;
$message .= “Content-Type: text/html; charset=UTF-8\n”;
$message .= “Content-Transfer-Encoding: 8bit\n\n”;
$message .= “<html>\n”;
$message .= “<body>\n”;
$message .= ‘<p>Dear ‘.$firstname.’ ‘.$lastname.’,</p>’;
$message .= ‘<p>Here is my HTML Email / Used for Meeting Description</p>’;
$message .= “</body>\n”;
$message .= “</html>\n”;
$message .= “–$mime_boundary\n”;
//Create ICAL Content (Google rfc 2445 for details and examples of usage, beware of adding tabs)
$ical = ‘BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
ORGANIZER:MAILTO:’.$from_address.’
DTSTART:’.$dtstart.’
DTEND:’.$dtend.’
LOCATION:’.$meeting_location.’
TRANSP:OPAQUE
SEQUENCE:0
UID:’.$cal_uid.’
DTSTAMP:’.$todaystamp.’
DESCRIPTION:’.$meeting_description.’
SUMMARY:’.$subject.’
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR’;
$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST;charset=utf-8\n';
$message .= 'Content-Transfer-Encoding: 8bit\n\n';
$message .= $ical;
//SEND MAIL
$mail_sent = #mail( $email, $subject, $message, $headers );
if($mail_sent) {
return true;
} else {
return false;
}
}
Imho it is not or should not be possible to post an invite that automatically will be accepted. Instead you should inform your users that they can they can change their settings in Outlook to automatically accept (certain) invites.
Btw thanks for your snippet. Just what I needed.
Hi for calendar auto acceptance you should add the given lines in your code to create ics file.
ATTENDEE;PARTSTAT=ACCEPTED;CN= ExampleName1 c;EMAIL=example1#mail.com:MAILTO:example1#mail.com
ATTENDEE;PARTSTAT=ACCEPTED;CN= ExampleName2 c;EMAIL=example2#mail.comMAILTO:example2#mail.com

perl get all message headers from imap message

I use Mail::IMAPClient
Have some variables
$body = $imap->body_string($msg);
$header = $imap->message_string($msg);
$body contains body of message, but $header contains header and body of message. I have not found a method in IMAPClient, who get only message header.
I need delete body from $header. Split $body and $header bad variant, because body can be very big. Body and header separates the empty string, but I do not know how to use it.
Please have a look at http://gagravarr.org/code/test-imap-headers.pl
It suggests the Mail::IMAPClient package supports/supported the 'keyword' "ALL" to get all headers at once:
my %headers = %{ $imap->parse_headers( $msg, "ALL" ) };
for my $h ( keys %headers ) {
my #hdrs = #{ $headers{$h} };
print "$h (" . scalar #hdrs . " entries)\n";
foreach (#hdrs) { print "\t$_\n"; }
}

replace text with url in twitter feed

I have this code:
public function linkify($status_text)
{
$status_text = preg_replace('/(https?:\/\/\S+)/','\1', $status_text);
$status_text = preg_replace('/(^|\s)#(\w+)/','\1#\2',$status_text);
$status_text = preg_replace('/(^|\s)#(\w+)/','\1#\2',$status_text);
return $status_text;
}
and display feeds from twitter like this
foreach($feed as $feed_item) {
$html .= '<li>';
$html .= '' . $this->linkify($feed_item->text) . '';
$html .= '' . $this->relativedate((strtotime($feed_item->created_at))) . '';
$html .= '</li>';
}
echo $html;
result of this code is
<li>Twitter Feed Text http://t.co/TnkNfxCdRu</li>
if anyone can help me, how can I add text inside tag <a></a>. for example, to be exactly like this:
<li>Twitter Feed Text</li>
Thank you so much
Just change your first preg_replace to:
$status_text = preg_replace('~(https?://(\S+))~','$2',$status_text);

How do I use LinkedIn API with Zend_OAuth?

I'm writing a class wrapper for LinkedIn API and I'm using Zend Framework 1.11.2. Here is a snippet I have:
$config = Pb_Portal::getInstance()->getConfig('linkedin.ini');
$body = '<?xml version="1.0" encoding="UTF-8"?>';
$body .= '<share>';
$body .= '<comment>83% of employers will use social media to hire: 78% LinkedIn, 55% Facebook, 45% Twitter [SF Biz Times] http://bit.ly/cCpeOD</comment>';
$body .= '<content>';
$body .= '<title>Survey: Social networks top hiring tool - San Francisco Business Times</title>';
$body .= '<submitted-url>http://sanfrancisco.bizjournals.com/sanfrancisco/stories/2010/06/28/daily34.html</submitted-url>';
$body .= '<submitted-image-url>http://images.bizjournals.com/travel/cityscapes/thumbs/sm_sanfrancisco.jpg</submitted-image-url>';
$body .= '</content>';
$body .= '<visibility>';
$body .= '<code>anyone</code>';
$body .= '</visibility>';
$body .= '</share>';
$client = Zend_Oauth::getHttpClient();
$client->setUri('http://api.linkedin.com/v1/people/~/shares');
$client->setMethod(Zend_Http_Client::POST);
$client->setRawData($body,'text/xml');
$client->setHeaders('Content-Type', 'text/xml');
$client->setParameterPost('oauth_consumer_key', $config->appKey);
$client->setParameterPost('oauth_nonce', $config->appSecretKey);
$client->setParameterPost('oauth_token', $acc->getToken());
$client->setParameterPost('oauth_timestamp', time());
$client->setParameterPost('oauth_signature_method', 'HMAC-SHA1');
$client->setParameterPost('oauth_version', '1.0');
$response = $client->request();
$xml = #simplexml_load_string($response->getBody());
And I have this response:
SimpleXMLElement Object
(
[status] => 401
[timestamp] => 1299581073233
[error-code] => 0
[message] => Unknown authentication scheme
)
Can somebody help me? Where I go wrong?
I had a similar problem (although I am just retrieving user info). This link helped a great deal. Instead of constructing the params as get variables, you allow the token to construct the http client from your options.
http://www.contentwithstyle.co.uk/content/linkedin-and-zendoauth/
You may need to change the way you are writing class wrapper.
You can take idea from this post and accepted answer there!!
Linkedin: How to make api calls using access token?
best of luck