Данные с cURL - Visavi.net https://visavi.net/ RSS - Visavi.net https://visavi.net/assets/img/images/logo_small.png RSS - Visavi.net https://visavi.net/ [email protected] (admin) [email protected] (admin) Thu, 25 Apr 2024 16:36:26 +0300 10. <strong>iNeeXT</strong>, возможно где то в вашем коде ошибка , потому что выводит это <a href="http://addres.ru/error" target="_blank" rel="nofollow">http://addres.ru/error</a> , а должно вывести что то вроде этого <a href="http://addres.ru/go/12345" target="_blank" rel="nofollow">http://addres.ru/go/12345</a> (цыфры изменяются) . Так как рабочий вариант есть считаю вопрос исчерпан , тему крою . https://visavi.net/topics/42585/685618 Данные с cURL Сергей Mon, 24 Aug 2015 16:36:08 +0300 Сообщения https://visavi.net/topics/42585/685618 Всё зделал и проверил работает , кого интересует вот код:<br> <pre class="prettyprint"> $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, &quot;http&#58;//addres.ru/search&quot;); curl_setopt($ch,CURLOPT_HEADER,true); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$forma); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); curl_exec($ch); $header=curl_getinfo($ch); curl_close($ch); echo $header&#91;&#039;url&#039;]; </pre> <br> <em><span style="font-size:x-small">Добавлено через 00:55 сек.</span></em><br> 10. <strong>iNeeXT</strong>, сейчас ваш код проверю , для интереса . https://visavi.net/topics/42585/685617 Данные с cURL Сергей Mon, 24 Aug 2015 16:21:15 +0300 Сообщения https://visavi.net/topics/42585/685617 Привет. <img src="https://visavi.net/uploads/stickers/smile.gif" alt="smile"> <br> насколько понял, то что-то не то тебе советуют.<br> Установи просто CURLOPT_FOLLOWLOCATION в TRUE. https://visavi.net/topics/42585/685616 Данные с cURL Tegos Mon, 24 Aug 2015 15:58:48 +0300 Сообщения https://visavi.net/topics/42585/685616 <pre class="prettyprint">&lt;?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, &quot;http&#58;//byvlad.ru/mp3/index.php?query=beatles&amp;sort=0&amp;action=query&amp;form=true&quot;); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_POST, true); $forma = array(); curl_setopt($ch, CURLOPT_POSTFIELDS, $forma); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $response = curl_exec($ch); curl_close($ch); list($headers_raw, $resp) = explode(&quot;\r\n\r\n&quot;, $response, 2); foreach (explode(&quot;\n&quot;, $headers_raw) as $header) { if (stripos($header, &#039;Location&#58;&#039;) !== false) { $address = str_replace(&#039;Location&#58; &#039;, null, $header); } } echo $address;</pre> <br> Сделал без функции http_parse_headers, так как она идет с модулем http, если он есть, то используй её. https://visavi.net/topics/42585/685615 Данные с cURL iNeeXT Mon, 24 Aug 2015 15:38:06 +0300 Сообщения https://visavi.net/topics/42585/685615 Пробовал curl_getinfo , получил только <a href="http://adress.ru/search" target="_blank" rel="nofollow">http://adress.ru/search</a> , а редирект не получается получить .<br> <br> <em><span style="font-size:x-small">Добавлено через 01:52 сек.</span></em><br> 8. <strong>miх</strong>, и что это мне даст ? https://visavi.net/topics/42585/685614 Данные с cURL Сергей Mon, 24 Aug 2015 15:34:46 +0300 Сообщения https://visavi.net/topics/42585/685614 curl_setopt($ch,CURLOPT_RETURNTRANSFER, <strong>1</strong>) https://visavi.net/topics/42585/685613 Данные с cURL mix Mon, 24 Aug 2015 15:34:18 +0300 Сообщения https://visavi.net/topics/42585/685613 6. <strong>DimmoS</strong>, curl отдаёт и выводит результат , но мне всё равно как его выводить , мне нужно редирект получить . https://visavi.net/topics/42585/685612 Данные с cURL Сергей Mon, 24 Aug 2015 15:32:08 +0300 Сообщения https://visavi.net/topics/42585/685612 5. <strong>LETGAM</strong>, как ты результат вообще выводишь? Я в твоем коде вообще вывода не вижу https://visavi.net/topics/42585/685611 Данные с cURL Dmitry Kokorin Mon, 24 Aug 2015 15:07:00 +0300 Сообщения https://visavi.net/topics/42585/685611 4. <strong>DimmoS</strong>, Не работает твой вариант , выводит только header который отдаёт curl и всё .<br> <br> <em><span style="font-size:x-small">Добавлено через 02:14 сек.</span></em><br> 2. <strong>iNeeXT</strong>, это могло бы и подойти но пока мне не ясно как применить . https://visavi.net/topics/42585/685610 Данные с cURL Сергей Mon, 24 Aug 2015 14:37:06 +0300 Сообщения https://visavi.net/topics/42585/685610 3. <strong>LETGAM</strong>, <pre class="prettyprint">&lt;?php $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, &quot;http&#58;//adress.ru/search&quot;); curl_setopt($ch,CURLOPT_HEADER,true); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$forma); curl_setopt($ch,CURLOPT_RETURNTRANSFER,0); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); $result = curl_exec($ch); curl_close($ch); $var = http_parse_headers($result); var_dump($var); </pre> <br> Если правильно понял https://visavi.net/topics/42585/685608 Данные с cURL Dmitry Kokorin Mon, 24 Aug 2015 14:17:44 +0300 Сообщения https://visavi.net/topics/42585/685608 Подскажите как мне header который выдаёт curl загнать в переменную . https://visavi.net/topics/42585/685607 Данные с cURL Сергей Mon, 24 Aug 2015 14:06:01 +0300 Сообщения https://visavi.net/topics/42585/685607 <a href="http://php.net/manual/ru/function.http-parse-headers.php" target="_blank" rel="nofollow">http://php.net/manual/ru/function.http-parse-headers.php</a> https://visavi.net/topics/42585/685603 Данные с cURL iNeeXT Mon, 24 Aug 2015 13:42:19 +0300 Сообщения https://visavi.net/topics/42585/685603 Привет мастерам , подскажите как мне с запроса curl: <br> <pre class="prettyprint"> $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, &quot;http&#58;//adress.ru/search&quot;); curl_setopt($ch,CURLOPT_HEADER,true); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$forma); curl_setopt($ch,CURLOPT_RETURNTRANSFER,0); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); curl_exec($ch); curl_close($ch); </pre> <br> который выдаёт вот такой header:<br> <pre class="prettyprint"> HTTP/1.1 302 Moved Temporarily Server&#58; nginx Date&#58; Mon, 24 Aug 2015 10&#58;11&#58;38 GMT Content-Type&#58; text/html; charset=UTF-8 Content-Length&#58; 0 Connection&#58; keep-alive Expires&#58; Thu, 19 Nov 1981 08&#58;52&#58;00 GMT Cache-Control&#58; no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma&#58; no-cache Set-Cookie&#58; Imperial=cc6f20153e3c027027292103db69b88f; path=/ Location&#58; http&#58;//addres.ru/search/378305 </pre> вытащить Location: , а именно этот адрес: <a href="http://addres.ru/search/378305" target="_blank" rel="nofollow">http://addres.ru/search/378305</a> https://visavi.net/topics/42585/685600 Данные с cURL Сергей Mon, 24 Aug 2015 13:23:16 +0300 Сообщения https://visavi.net/topics/42585/685600