Using Snoopy PHP class in Drupal -


i don't know drupal have managed create simple html page use first , last name inputted run snoopy.class.php run script on web site retrieve data. button should run function submit url not getting results.

because don't know how debug in drupal added echo statements see how far code ran seems stopping when tries create new snoopy object. downloaded class , put in think accessible folder, namely public_html/tools it:

-rw-r--r-- 1 agentpitstop apache 37815 sep  3 21:03 snoopy.class.php  

below code using

<form method="post"> <p>last name: <input type="text" name="lastname" /><br />    first name: <input type="text" name="firstname" /></p>  <p><input type="submit" value="send it!"></p> </form>  <?php  if($_post) {    echo "1st display  <br />\n";     $url = "https://pdb-services-beta.nipr.com/pdb-xml-reports/hitlist_xml.cgi?";   $url = $url . "customer_number=beta83agent&pin_number=nipr123&report_type=1";    $lastname = $_post['lastname'];         $firstname = $_post['firstname'];       $parms = array("name_last"=>$lastname,"name_first"=>$firstname);        echo "2nd display  <br />\n";         $result = curl_download($url,$parms);       $xml=simplexml_load_file("$result.xml");       $nipr_id = $xml->npn;        echo "url " . $url . "<br />\n";       echo "agent  " . $_post['firstname'] . " " . $_post['lastname'] . " id is:".  $nipr_id  . "<br />\n";       echo "3rd result call " . $result . "<br />\n";    } ?>          <?php             include "snoopy.class.php";     function curl_download($url,$parms)     {  echo "in call curldownload "; $snoopy = new snoopy(); echo "after setting object";  $snoopy->curl_path = "/usr/bin/curl";  # or whatever path curl - 'which curl' in terminal give you.  needed because snoopy uses standalone curl deal https sites, not php_curl builtin. echo "after setting path"; $snoopy->httpsmethod = "post"; echo "after setting post"; $snoopy->submit($url, $parms); echo "after setting submit"; print $snoopy->results; echo "results: " . results; return $snoopy->results; } ?> 

any appreciated.

if need custom development on drupal site create custom module , use drupal's form api.

if need perform http request php, use php library/extension, such php-curl, guzzle or drupal's drupal_http_request(). , yes, support https.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -