[OPEN-ILS-DEV] error connecting to openSRF service

Bob Wicksall bwicksall at pls-net.org
Tue May 29 09:19:49 EDT 2012


This example code works.  It adds 2+2.  

<?php
  // *********************************************
  //
  // MATH Example!!!  This one works!
  //
  // *********************************************
  
  $catalog_host = 'evergreen.owwl.org';
  
  $ch = curl_init();
  
  $url = 'http://'.$catalog_host.'/osrf-http-translator';
  
  $header = array(
                  'X-OpenSRF-service: opensrf.math' 
                 );  
                 
  $data = '[{"__c":"osrfMessage","__p":{"threadTrace":0,"type":"REQUEST","payload":{"__c":"osrfMethod","__p":{"method":"add","params":[2,2]}},"locale":"en-US"}}]';
  $data = 'osrf-msg=' . urlencode($data);

  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HEADER, 1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
  
  $server_result = curl_exec($ch); 
  
  echo '<pre>';
  echo $server_result;
  echo '</pre>';
  
  echo '<HR />';
  echo $data;
  
  curl_close($ch);

?>


Bob Wicksall
Systems Administrator

Pioneer Library System
2557 State Rt. 21
Canandaigua, New York  14424

Voice: (585) 394-8260
Fax: (585) 394-1935

----- Original Message -----
> From: "Pranjal Prabhash" <pranjal.prabhash at gmail.com>
> To: open-ils-dev at list.georgialibraries.org
> Sent: Sunday, May 27, 2012 7:18:33 AM
> Subject: [OPEN-ILS-DEV] error connecting to openSRF service
> 
> Hello,
> 
> I went through the article "
> http://www.open-ils.org/dokuwiki/doku.php?id=opensrf_over_http ". I
> have changed my "basic openSRF php client" code. Still I am unable
> to connect to the service. I really need some help connecting to the
> service.
> 
> Thankyou
> 
> 
> Regards
> Pranjal
> 


More information about the Open-ils-dev mailing list