Guest User

Untitled

a guest
Dec 15th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. $ch = curl_init();
  2.  
  3. curl_setopt($ch, CURLOPT_URL,$url);
  4. curl_setopt($ch, CURLOPT_POST, 1);
  5.  
  6. $postfields = array();
  7. $postfields['CostCode'] = '999999801';
  8.  
  9. curl_setopt($ch, CURLOPT_POSTFIELDS,
  10. $postfields);
  11.  
  12. curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  13. 'Content-Type: multipart/form-data;
  14. charset=UTF-8',
  15. 'Connection: Keep-Alive'
  16. ));
  17.  
  18. // receive server response ...
  19. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  20.  
  21. $server_output = curl_exec ($ch);
  22.  
  23. curl_close ($ch);
  24.  
  25. $postfields = array();
  26. $postfields['CostCode'] = '999999801';
  27.  
  28. $client = new ZendHttpClient();
  29.  
  30. $client->setAdapter(new ZendHttpClientAdapterCurl());
  31.  
  32. $request = new ZendHttpRequest();
  33.  
  34. $request->setUri($url);
  35. $request->setMethod(ZendHttpRequest::METHOD_POST);
  36. $request->getHeaders()->addHeaders([
  37. 'Content-Type' => 'multipart/form-data; charset=UTF-8'
  38. ]);
  39.  
  40. $request->setContent($postfields);
  41.  
  42. $response = $client->dispatch($request);
Add Comment
Please, Sign In to add comment