juniorspecialistphp

juniorspecialistphp
Рейтинг
25
Регистрация
08.08.2010

Если актуально, то в личку ТЗ вышлите.

А если так

$topicid = 3;

$cnt = 0;
$sql = "SELECT storyid, title, hometext FROM ".$db->prefix("stories")." WHERE topicid=".$topicid." AND published>0 AND published<".time()." ORDER BY published DESC";
$result = $db->query($sql, 3, 0);
while (list($storyid, $title, $hometext) = $db->fetch_row($result)) {
echo "<p><a href='/article.php?storyid=$storyid'>$title</a></p>";
if($cnt==0){
echo "<p>$hometext</p><br>";
}
$cnt++;
}

Добрый день. Отпишитесь в личку ссылку на каталог и по подробнее задание.

Вас интересует исключительно десктопное приложение или возможен php скрипт?

Там за 40т. рублей продают, а у вас за 100$, какая-то не правильная магия цифр выходит :) Может Вы нолик забыли дописать в конце..

Какова цена вопроса?

За 10$ врятли кто-то согласиться, или качество работы будет соответствующим оплате. Интересно откуда у Вас данные сколько ж эта работа стоит, если Вы знаете :) Могу сделать этот скрипт за 25$ и то потому, что очень деньги нужны сейчас.

Там адрес страницы, куда я отправляю POST запрос.

function curl_redir_exec1($ch,$debug=false){

static $curl_loops = 0;
static $curl_max_loops = 20;
if ($curl_loops++ >= $curl_max_loops){
$curl_loops = 0;
return FALSE;
}
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$debbbb = $data;
list($header, $data) = explode("\n\n", $data, 2);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$new_url="";
if ($http_code == 301 || $http_code == 302) {
$matches = array();
preg_match('/Location:(.*?)\n/', $header, $matches);
$url = parse_url(trim(array_pop($matches)));
print_r($url);
if (!$url){ //couldn't process the url to redirect to
$curl_loops = 0;
return $data;
}
$last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
$new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] .($url['query']?'?'.$url['query']:'');
curl_setopt($ch, CURLOPT_URL, $new_url);
if($debug){echo "Loop $curl_loops: Redirecting to $new_url\n";flush();}
return curl_redir_exec1($ch);

} else {
$curl_loops=0;
return $debbbb;
}
}
//=========================================
$ch=curl_init();
//--отдаём куку и отправляем свои данные-ЛОГИНИМСЯ
curl_setopt($ch, CURLOPT_URL,$_POST['url_posting']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch , CURLOPT_HTTPHEADER , $header );
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_redir_exec1($ch,true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_REFERER,$_POST['ref']);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_fields);
curl_setopt($ch, CURLOPT_USERAGENT, $_POST['user_agent']);
curl_setopt($ch, CURLOPT_COOKIEFILE, $_POST['cookies_path']);
curl_setopt($ch, CURLOPT_COOKIEJAR, $_POST['cookies_path']);
$result=curl_exec($ch);
return $result;

Не переходит и не отлавливает куда дальше переходить. Что-то в функции не так :(

Всего: 198