php - <request> <action>getCategories</action> <params /> -


i got code , need write additional code make work:

<ul>     <li><a href="?test=1">1</a></li>      <li><a href="?test=2">2</a></li> </ul> <hr> <?php $itest = (int) $_get['test']; $sxml = '<?xml version="1.0" encoding="utf-8"?>'."\n"; switch ($itest) {     case 1:         $sxml .= '<request>   <action>getcategories</action>    <params /> </request>';         break;     case 2:         $sxml .= '<request>   <action>getproducts</action>   <params>     <catid>1</catid>     <page>1</page>   </params>  </request>';         break;     default:         exit();         break; } 

i understand should need write input file according action send, how should treat :

<request>       <action>getproducts</action>       <params>         <catid>1</catid>         <page>1</page>       </params>      </request> 

if simple variable ok dont how around it

whats here clear me, send sxml input , return result:

$ocurl = curl_init(); curl_setopt($ocurl, curlopt_url, 'http://localhost/joboffer/input.php'); curl_setopt($ocurl, curlopt_post, true);  curl_setopt($ocurl, curlopt_postfields, $sxml); curl_setopt($ocurl, curlopt_ssl_verifypeer,false);  curl_setopt($ocurl, curlopt_returntransfer, true); curl_setopt($ocurl, curlopt_fresh_connect, true); curl_setopt($ocurl, curlopt_httpheader,      array(         'content-type: text/xml; charset=utf-8',          'expect: '     ) );  $srespond = curl_exec($ocurl); $irespondcode = curl_getinfo($ocurl, curlinfo_http_code); curl_close($ocurl);  echo '<pre>respond  ', $irespondcode, "\n\n", htmlentities($srespond); 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -