Allow Incoming Responses Apache. On Ubuntu 11.10 - Curl
Posted
by
Daniel Adarve
on Super User
See other posts from Super User
or by Daniel Adarve
Published on 2012-03-25T21:13:05Z
Indexed on
2012/03/25
23:34 UTC
Read the original article
Hit count: 496
networking
I'm trying to get a Curl Response from an outside server, however I noticed I cant neither PING the server in question nor connect to it.
I tried disabling the iptables firewall but I had no success. My server is running behind a Cisco Linksys WRTN310N Router with the DD-wrt firmware Installed. In which I already disabled the firewall.
Here are my network settings: Ifconfig
eth0 Link encap:Ethernet HWaddr 00:26:b9:76:73:6b
inet addr:192.168.1.120 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::226:b9ff:fe76:736b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:49713 errors:0 dropped:0 overruns:0 frame:0
TX packets:30987 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:52829022 (52.8 MB) TX bytes:5438223 (5.4 MB)
Interrupt:16
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:341 errors:0 dropped:0 overruns:0 frame:0
TX packets:341 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:27604 (27.6 KB) TX bytes:27604 (27.6 KB)
/etc/resolv.conf
nameserver 192.168.1.1
/etc/nsswitch.com
passwd: compat
group: compat
shadow: compat
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
/etc/host.conf
order hosts,bind
multi on
/etc/hosts
127.0.0.1 localhost
127.0.0.1 callcenter
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.120
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255
gateway 192.168.1.1
The Url to which im trying to get a connection to is https://www.veripayment.com/integration/index.php When I ping it on terminal heres what I get
daniel@callcenter:~$ ping https://www.veripayment.com/integration/index.php
ping: unknown host https://www.veripayment.com/integration/index.php
daniel@callcenter:~$ ping www.veripayment.com
PING www.veripayment.com (69.172.200.5) 56(84) bytes of data.
--- www.veripayment.com ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1007ms
PHP Function in codeigniter
public function authorizePayment(){
//---------------------------------------------------
// Authorize a payment
//---------------------------------------------------
// Get variables from POST array
$post_str = "action=payment&business=" .urlencode($this->input->post('business'))
."&vericode=" .urlencode($this->input->post('vericode'))
."&item_name=" .urlencode($this->input->post('item_name'))
."&item_code=" .urlencode($this->input->post('item_code'))
."&quantity=" .urlencode($this->input->post('quantity'))
."&amount=" .urlencode($this->input->post('amount'))
."&cc_type=" .urlencode($this->input->post('cc_type'))
."&cc_number=" .urlencode($this->input->post('cc_number'))
."&cc_expdate=" .urlencode($this->input->post('cc_expdate_year')).urlencode($this->input->post('cc_expdate_month'))
."&cc_security_code=" .urlencode($this->input->post('cc_security_code'))
."&shipment=" .urlencode($this->input->post('shipment'))
."&first_name=" .urlencode($this->input->post('first_name'))
."&last_name=" .urlencode($this->input->post('last_name'))
."&address=" .urlencode($this->input->post('address'))
."&city=" .urlencode($this->input->post('city'))
."&state_or_province=" .urlencode($this->input->post('state_or_province'))
."&zip_or_postal_code=" .urlencode($this->input->post('zip_or_postal_code'))
."&country=" .urlencode($this->input->post('country'))
."&shipping_address=" .urlencode($this->input->post('shipping_address'))
."&shipping_city=" .urlencode($this->input->post('shipping_city'))
."&shipping_state_or_province=" .urlencode($this->input->post('shipping_state_or_province'))
."&shipping_zip_or_postal_code=".urlencode($this->input->post('shipping_zip_or_postal_code'))
."&shipping_country=" .urlencode($this->input->post('shipping_country'))
."&phone=" .urlencode($this->input->post('phone'))
."&email=" .urlencode($this->input->post('email'))
."&ip_address=" .urlencode($this->input->post('ip_address'))
."&website_unique_id=" .urlencode($this->input->post('website_unique_id'));
// Send URL string via CURL
$backendUrl = "https://www.veripayment.com/integration/index.php";
$this->curl->create($backendUrl);
$this->curl->post($post_str);
$return = $this->curl->execute();
$result = array();
// Explode array where blanks are found
$resparray = explode(' ', $return);
if ($resparray)
{
// save results into an array
foreach ($resparray as $resp) {
$keyvalue = explode('=', $resp);
if(isset($keyvalue[1])){
$result[$keyvalue[0]] = str_replace('"', '', $keyvalue[1]);
}
}
}
return $result;
}
This gets an empty result array. This function however works well in the previous server where the script was hosted before. No modifications where made whatsoever
Thanks in Advance
© Super User or respective owner