Solved

CURL, Client URL Library Functions-  Problem with URL

Posted on 2006-11-30
3
195 Views
Last Modified: 2008-03-17
I use simple CURL code:

in main.php page:
<?php
$c=curl_init();

curl_setopt ($c, CURLOPT_URL, "loadsite.php");
curl_setopt ($c, CURLOPT_REFERER, "referersite");
curl_exec ($c);
curl_close ($c);

?>

When the loadsite.php uses CSS defined in an extern file ( <link rel=StyleSheet href="css/style.css" type="text/css" media=screen>
), then the extern file is not loaded because the URL of the page in the browser is main.php and NOT loadsite.php.

How can I solve this problem?
0
Comment
Question by:jodavid
3 Comments
 
LVL 13

Accepted Solution

by:
rhickmott earned 250 total points
ID: 18044380
You could always use an preg_replace to replace all links with their full alternatives ie http://<site>/page.css

CURL will only pull one page at a time the only way you would be able to do it is rewrite the urld to css and images so they point at the ones on the original location or search for CSS links and then issue a seprate CURL to pull the style sheet and insert the source of that stylesheet inline into the page.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Link failure 16 70
PHP: Filling Out/Creating a PDF 29 109
Date comparison to same 'wednesday' of previous year 3 29
Generate PDF's using TCPDF - Initial Set Up 9 33
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question