Tag Archives: https

Python SimpleHTTPServer with PHP

Questions: I used python -m SimpleHTTPServer, but the PHP files don’t execute instead they just been downloaded. I heard about WPHP in an old post. But I don’t know how to use it. How I can work with it ? Answers:

How to scrape a SSL or HTTPS URL

Questions: I have written a function to scrape a website using CURL but it returns nothing when called and can’t understand why. The output is empty <?php function scrape($url) { $headers = Array( “Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5”, “Cache-Control: max-age=0”, “Connection: keep-alive”, “Keep-Alive: 300”, “Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7”, “Accept-Language: en-us,en;q=0.5”, “Pragma: ” ); $config = Array( CURLOPT_RETURNTRANSFER => TRUE ,… Read More »

Undefined index error using $_SERVER['HTTPS']

Questions: Debug is throwing… Notice: Undefined index: HTTPS in C:\xampplite\htdocs\testsite\wp-content\themes\mytheme\header.php on line 4 How can I change my function below to prevent the error? function curPageURL() { $pageURL = ‘http’; if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;} } Would this be the equivalent? if ( isset( $_SERVER[“HTTPS”] )) {$pageURL .= “s”;} Answers:

How to send HTTPS posts using php

Questions: I’m setting up a custom e-commerce solution, and the payment system I’m using requires me to send HTTPS POSTS. How can I do this using php (and CURL?), is it any different from sending http posts? UPDATE: Thanks for your replies, they’ve been very useful. I assume I will need to purchase an SSL… Read More »

How do I remove http, https and slash from user input in php

Questions: Example user input http://domain.com/ http://domain.com/topic/ http://domain.com/topic/cars/ http://www.domain.com/topic/questions/ I want a php function to make the output like domain.com domain.com/topic/ domain.com/topic/cars/ www.domain.com/topic/questions/ Let me know 🙂 Answers:

XMLHttpRequest; Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource

Questions: When I try to do a ajax call, I got the error on chrome below. XMLHttpRequest cannot load javascript:;. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. Here is code: $.ajax({ type: “POST”, data: {pvalue : pid}, cache: false, url: “xxx.in/yy/ajax.php”, success: function(data) { $modal.find(‘.edit-content’).html(data); } Answers: