Jump to content

Search the Community

Showing results for tags 'curl'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 9 results

  1. Php Guys, Are you aware of any function or method where I can prevent downloads ? Imagine a page with a lot of links. Like: links to pages and links to imgs or links to downloads. Now, imagine I fetched that page with curl and the user is viewing the links present on the page. Q1a. Now, if I were to prevent any downloads from the download links. How would I do it ? Q1b -. Any php function that manages this prevention ? Q1b - If not, then any workarounds you can think of ? I'm thinking of str_replacing the download links so they no longer showup as download links but as something else such as nothing. Q2a. How would you get your cURL script to spot a download link and get it to not appear on your user's screen ? Q2b. Would you get the script to check for the file extension that would reveal if it's a viewable file (html page, img file, etc.) or a downloading file ? Q2c. What are the long list of download file extensions ? When I cURL fetch or build my own web proxy or build my crawler, have to make sure they ignore download links.
  2. Folks, Usually cURL works on my xampp. So, why not tonight ? I see white blank page! <?php /* ERROR HANDLING */ declare(strict_types=1); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $url='https://oscarliang.com'; $ch=curl_init(); $timeout=5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // Get URL content $lines_string=curl_exec($ch); // close handle to release resources curl_close($ch); //output, you can also save it locally on the server echo $lines_string; ?>
  3. Fellow Php'ers, I'm a php learner. Beginner. Very enthusiastic enough to try to build my own web proxy. See how far I have reached. The following is cURL. It shows you a ui text box where you type a url and cURL would fetch that url. 1. Now, in that fetched url, there could be links like so: <a href="http://www.google.com">Google</a> <a href="http://yahoo.com">Yahoo</a> This script is supposed to precede 'proxified_page_test.php?url_to_proxify=' on all links. So now, the links present on the proxified page (cURL fetched page) should look like this: <a href="proxified_page_test.php?url_to_proxify=http://www.google.com">Google</a> <a href="proxified_page_test.php?url_to_proxify=http://yahoo.com">Yahoo</a> 2. Also, in that fetched url, there could be a search box, like the google search box. Search box containing search box code like so ... "....action = http://google.com/q?" Again, this script is supposed to precede 'proxified_page_test.php?url_to_proxify=' on all links including on those forms that forward you to their processor.php. So now, the links present on the proxified page (cURL fetched page) should look like this: "....action = proxified_page_test.php?url_to_proxify=http://google.com/q?" That way, if you do a search on the proxified page then the SERPs presented would contain links where proxified_page_test.php?url_to_proxify= have been added. That way, if you were viewing google and doing a search, the SERPs presented would list links that precede the "proxified_page_test.php?url_to_proxify=" so that the result links can also be proxified when clicked. ISSUE Problem is, if you type "http://www.google.com" then it does not fetch that page. What is hindering the fetch ? <?php /* ERROR HANDLING */ declare(strict_types=1); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); /* STEP 2: The IF gets triggered as soon as the "submit" button is clicked in the ui text box labeled: Url Following IF code deals with GET method. */ if(isset($_GET["url_to_proxify"]) === TRUE) { echo "IF got triggered!"; $url_to_proxify = filter_input(INPUT_GET, 'url_to_proxify', FILTER_VALIDATE_URL); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "$url_to_proxify"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_HEADER, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $curl_result = curl_exec($ch); $domain = parse_url($url_to_proxify, PHP_URL_HOST); echo var_dump($domain); //Add proxy link on all links present on proxified page $pattern = array("http://", "https://", "http://www.", "https://www.", "localhost"); $replace = array("proxified_page_test.php?url_to_proxify=http://\".$domain\"", "proxified_page_test.php?url_to_proxify=https://\".$domain\"", "proxified_page_test.php?url_to_proxify=http://www.\".$domain\"", "proxified_page_test.php?url_to_proxify=https://www.\".$domain\"", "proxified_page_test.php?url_to_proxify=http://www.\".$domain\""); $string_replaced_data = str_replace($pattern, $replace, $curl_result); echo var_dump($string_replaced_data); //Add proxy link on all Image Links (Eg. Google Img File) $pattern = array('src="', 'src = "', 'src= "', 'src ="', "src='", "src = '", "src= '", "src='"); $replace = array('src="proxified_page_test.php?url_to_proxify=\".$domain\""', 'src = "proxified_page_test.php?url_to_proxify=\".$domain\""', 'src= "proxified_page_test.php?url_to_proxify=\".$domain\""', 'src ="proxified_page_test.php?url_to_proxify=\".$domain\""', "src='proxified_page_test.php?url_to_proxify=\".$domain\"'", "src = 'proxified_page_test.php?url_to_proxify=\".$domain\"'", "src= 'proxified_page_test.php?url_to_proxify=\".$domain\"'", "src ='proxified_page_test.php?url_to_proxify=\".$domain\"'"); $string_replaced_data = str_replace($pattern, $replace, $curl_result); echo var_dump($string_replaced_data); //Add proxy link on all links presented by the searchengine result pages (SERPS). Eg. Google Search Pages (SERPs) $pattern = array('action="', 'action = "', 'action= "', 'action ="', "action='", "action = '", "action= '", "action='"); $replace = array('action="proxified_page_test.php?url_to_proxify=\".$domain\""', 'action = "proxified_page_test.php?url_to_proxify=\".$domain\""', 'action= "proxified_page_test.php?url_to_proxify=\".$domain\""', 'action ="proxified_page_test.php?url_to_proxify=\".$domain\""', "action='proxified_page_test.php?url_to_proxify=\".$domain\"'", "action = 'proxified_page_test.php?url_to_proxify=\".$domain\"'", "action= 'proxified_page_test.php?url_to_proxify=\".$domain\"'", "action ='proxified_page_test.php?url_to_proxify=\".$domain\"'"); $string_replaced_data = str_replace($pattern, $replace, $curl_result); echo var_dump($string_replaced_data); print_r($curl_result); curl_close($ch); } else { echo "ELSE got triggered!"; //Html Form ?> <html> <body> <form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "GET"> Url: <input type = "text" name = "url_to_proxify" /> <input type = "submit" /> </form> </body> </html> <?php } ?>
  4. somebody have an example or reference for PHP code that make login to a website and handle with the redirection after? thanks!
  5. Hi, I have a PHP script using the cURL function. This script send the data by a web service. It works often without problem. Sometimes, he sent a double data : same data by two times. I checked the log file this script (by curl_getinfo) on "total_time" When this script works correctly (it send the data only one time) : the total_time is less than 6 second. but when the total_time is more than 7 second, (this is a casual/occasional situation), my script send same data by two times so it is double data! So the web service send the ACK(Acknowledgment) which takes a long time (more than 7 second) and then, the TCP send again same data to a web service. How can I avoid this doubling ? By increasing this time waiting / time limit ? How can I define this time limit for 12 second? Could you help me : Thanks
  6. I need to ask my host to open a port for outbound connections via cURL. THey are telling me that they cannot open inbound ports for my hosting package type. I have been told that curl or file_get_contents makes an outbound connection. I can't seem to verify this through the docs unless I am missing something. Can anyone verify before I go back to my host and make a fool of myself?
  7. i am trying to load the current users images from instagrams api. i got there user id and other things but i cant seem to get the recent media that they posted ... here is the codes im using protected $_endpointUrls = array( 'authorize' => 'https://api.instagram.com/oauth/authorize/?client_id=%s&redirect_uri=%s&response_type=%s', 'access_token' => 'https://api.instagram.com/oauth/access_token', 'user' => 'https://api.instagram.com/v1/users/%d/?access_token=%s', 'user_feed' => 'https://api.instagram.com/v1/users/self/feed?%s', 'user_recent' => 'https://api.instagram.com/v1/users/%s/media/recent/?access_token=%s&max_id=%s&min_id=%s&max_timestamp=%s&min_timestamp=%s',); public function getUserRecent($id, $maxId = '', $minId = '', $maxTimestamp = '', $minTimestamp = '') { $endpointUrl = sprintf($this->_endpointUrls['user_recent'], $id, $this->getAccessToken(), $maxId, $minId, $maxTimestamp, $minTimestamp); $this->_initHttpClient($endpointUrl); return $this->_getHttpClientResponse(); } this is where i call upon those two to get the users photos but it wont display them <? $userphotos = $instagram-> getUserRecent($_SESSION['InstagramAccessToken']); $photos = json_decode($userphotos, true); ?> <?= $photos['data']['user']['user_recent'] ?>
  8. hello guys i have been tryning this code for quite sum time now. it sends sms but i want the server response to display without refreshing the page, i have use cURL extension and cant seem to get it working. the script run smooth but it return the url as the response and it does not execute the url here is the code <?php class send { public $username; public $password; public $destination; public $sender; public $msg; public $type; public $dlr; public $url; function __construct() { } function send_sms(){ $posturl = 'http://121.241.242.114:8080/bulksms/bulksms?'; $number = $this->destination; $number = urlencode($number); $msg = urlencode($this->msg); $type='0'; $dlr='0'; $url=''; $posturl = $posturl."source=".$this->sender."&username=".$this->username."&password=".$this->password."&type=".$type."&dlr=".$dlr."&destination=".$number."&message=".$msg; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $posturl); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); return $posturl; } } ?> i have no idea wat am i doing wrong. the results are getting captured by javasript from the original page but only display the url and does not execute it
  9. hi im working with instagram API and it uses Curl ... i sorta get it but is there a site where i could learn more or anyone here that knows about curl?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.