PHP Curl HTTP 500错误

时间:2015-02-07 01:37:03

标签: php http curl libcurl

我想在该网站上制作自动注册,并且服务器始终发回500错误。这是我的代码:

<?php
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_REFERER, 'http://www.hobba.fm/register');
curl_setopt($ch, CURLOPT_URL,'http://www.hobba.fm/account/register'); 
curl_setopt($ch, CURLOPT_FAILONERROR, TRUE); 
curl_setopt($ch, CURLOPT_TIMEOUT, 180); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 
curl_setopt($ch, CURLOPT_POST, TRUE); 
curl_setopt($ch, CURLOPT_POSTFIELDS, '_token=94ZCzU8O0wYQj1KGq6cOPHaKnAk4hcGAfQzg5DKg&registration-gender=M&registration-name=dkuser20&registration-email=dkuser20@hotmail.com&registration-day=10&registration-month=10&registration-year=1990&registration-password=123456&registration-password-v=123456&registration-disclaimer=on');  
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')); 
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$response = curl_exec($ch); 

if (!$response) { 
    $http_code = curl_getinfo($ch); 
    echo "<pre>";print_R($http_code);
    die(' Unable to connect to server. Please come back later.');        
    curl_close($ch);        
} 
curl_close($ch);
?>

服务器响应就是这个:

Array
(
    [url] => http://www.hobba.fm/account/register
    [content_type] => 
    [http_code] => 500
    [header_size] => 0
    [request_size] => 525
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.453
    [namelookup_time] => 0.015
    [connect_time] => 0.015
    [pretransfer_time] => 0.015
    [size_upload] => 288
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 52
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 5.453
    [redirect_time] => 0
)
 Unable to connect to server. Please come back later.

我确实在服务器上启用了curl,因为它是一个localhost,包是这个:

点击The Image Package here

任何想法为什么不在该服务器上运行此代码,我读了另一篇文章,他们说这是因为SSL,但也不起作用。

对于记录,令牌始终相同,只是每天更改。

我真的会在这个问题上找到任何帮助

0 个答案:

没有答案