2015-06-23 68 views
1

=====PHP,iptables的,並請求燒瓶

我有一個程度的成功連接到與的fsockopen服務器的更新。但是,如果可能的話,我想使用cUrl。

=====

原始

我想提出一個要求在後的形式使用curl到瓶中。目標不是使用jQuery,而是實現更多的信息分離和驗證。儘管能夠從我的桌面發出請求,但我無法通過Web服務器發出請求。我有iptables運行,並列出了下面的規則。另外,我列出了PHP代碼。我根本沒有收到燒瓶的任何輸出。

技術:

去爸爸那裏請求作出

的Go Daddy託管帳戶VPS的燒瓶服務器

iptables的:

ACCEPT all -- c-xxx.xxx.xxx anywhere 
ACCEPT all -- ip-xxx.xxx.xxx anywhere 

的IP列表是從網絡服務器,但c列表來自我的桌面。從PHP

$ch=curl_init(); 
curl_setopt($ch,CURLOPT_URL,$url); 
curl_setopt($ch, CURLOPT_TIMEOUT, 400); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, True); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, True); 
curl_setopt($ch, CURLOPT_PORT, 8888); 
curl_setopt($ch, CURLOPT_POST, count($data)); 
curl_setopt($ch, CURLOPT_POSTFIELDS, array('url'=>'login','user'=>$user,'pass'=>$pass,'auth'=>$authstring,'ip'=>$ip)); 

$result = curl_exec($ch); 

這個請求

捲曲請求甚至不使用tcpdump -i eth0的8888端口從我的桌面的要求不像登記。該IP地址是正確的。

該請求正在Aptana工作。

特定的錯誤是:

* Rebuilt URL to: xxx.xx.xx.xx/ 
* Hostname was found in DNS cache 
* Trying xxx.xx.xx.xx... 
* connect to xxx.xx.xx.xx port xx failed: Connection refused 
* Failed to connect to xxx.xx.xx.xx port xx: Connection refused 
* Closing connection 8 

這之後完全沖洗我的iptables。在集錦用相同的PHP版本,我得到:

Trying xxx.xx.xx.xx... 
* Adding handle: conn: 0x278fa30 
* Adding handle: send: 0 
* Adding handle: recv: 0 
* Curl_addHandleToPipeline: length: 1 
* - Conn 0 (0x278fa30) send_pipe: 1, recv_pipe: 0 
* Connected to XXX.XX.XX.XX (XXX.XX.XX.XX) port XXXX (#0) 
> POST/HTTP/1.1 
Host: xxx.xx.xx.xx:xx 
Accept: */* 
Content-Length: 29 
Content-Type: application/x-www-form-urlencoded 

* upload completely sent off: 29 out of 29 bytes 
* HTTP 1.0, assume close after body 
< HTTP/1.0 200 OK 
< Content-Type: text/html; charset=utf-8 
< Content-Length: 4 
< Server: Werkzeug/0.10.4 Python/2.7.5 
< Date: Wed, 24 Jun 2015 07:04:28 GMT 
< 
+0

在日誌中是否有任何錯誤的PHP? – Perry

+0

不是我能看到的,而是來自不同程序中拼錯單詞的前一個錯誤。 –

回答

0

不幸的是,從GoDaddy的託管服務代表告訴我,只有下面的端口是開放的我。 80,21 ftp,22 SFTP,445 ssl,3306 mysql。基本上,我不能發送任何東西。我不得不切換託管服務。 Go Daddy的VPS也可以工作。