Nasıl bir Safari uzantısı cURL kodu ile bir PHP komut dosyası çalıştırabilirsiniz?

0 Cevap php

Ben bir Safari uzantısı bir PHP bot işlevi çalıştırmak için çalışıyorum.

Bu benim araya denedim HTML kodu, ancak PHP ve cURL ve HTML bir karmaşa var ve gerçekten ben ne yapıyorum bilmiyorum.

I http://www.barattalo.it/2010/08/09/send-push-notification-to-iphone-with-php-and-pushme-to/ bu kodu gelmeden önce ben cURL kullanmaya teşebbüs hiç, ve uzatma ben $ ch başlatmak çalıştığınızda çalışma durur gibi görünüyor. Ben cURL komutları çalıştırmak gerekir, çünkü belli ki, kodun tüm amacı yendi.

Bu çalışma almak için herhangi bir ipucu?

 function performCommand(event)
 {    if (event.command === "sendLink") { 
pushMeTo($u,$t,$s);      }


 function pushMeTo($widgeturl, $text, $signature)
 { $agent = "Mozilla/5.0 (windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12";
  $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $widgeturl);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  $page = curl_exec($ch);
   preg_match("/form action=\"(.*?)\"/", $page, $form_action);
   preg_match("/textarea name=\"(.*?)\"/", $page, $message_field);
   preg_match("/input type=\"text\" name=\"(.*?)\"/", $page, $signature_field);

  $ch = curl_init();

  $strpost = $message_field[1].'=' . urlencode($text) . '&'.$signature_field[1].'=' . urlencode($signature);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $strpost );
   curl_setopt($ch, CURLOPT_URL, $form_action[1]);
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_USERAGENT, $agent);    
  $page = curl_exec($ch);
 }

0 Cevap